angularjs – 角度2 – 快速添加/删除组件
发布时间:2020-12-17 09:03:29 所属栏目:安全 来源:网络整理
导读:我需要能够添加移动角度2组件.为此,我正在使用loadIntoLocation和处理方法,像它一样: 添加组件(来自布局管理器): this.m_loader.loadIntoLocation(MyComponent,this.m_element,'content').then(_componentRef = { // Create the window and set its title:
我需要能够添加&移动角度2组件.为此,我正在使用loadIntoLocation和处理方法,像它一样:
添加组件(来自布局管理器): this.m_loader.loadIntoLocation(MyComponent,this.m_element,'content').then(_componentRef => { // Create the window and set its title: var component: MyComponent = (_componentRef.instance); component.ref = _componentRef; // init the component content }); 删除组件(从组件): this.ref.dispose(); 几乎工作: 有没有办法正确地使角质破坏组分,或至少迫使它创造新的?
正如蒂姆所说, 引用@ tbosch的comment
所以为了避免这种行为,从评论中也可以使用APP_VIEW_POOL_CAPACITY并将其分配为0作为值. bootstrap(MyApp,[provide(APP_VIEW_POOL_CAPACITY,{useValue: 0})]) 更新 请注意,由于beta1 APP_VIEW_POOL_CAPACITY已被#5993删除,并且正在正确地重新创建DOM. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |