当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ListWrapper.insert方法代码示例

本文整理汇总了TypeScript中angular2/src/facade/collection.ListWrapper.insert方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ListWrapper.insert方法的具体用法?TypeScript ListWrapper.insert怎么用?TypeScript ListWrapper.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/facade/collection.ListWrapper的用法示例。


在下文中一共展示了ListWrapper.insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: attachViewInContainer

 // Misnomer: this method is attaching next to the view container.
 attachViewInContainer(parentView: viewModule.AppView, boundElementIndex: number,
                       contextView: viewModule.AppView, contextBoundElementIndex: number,
                       atIndex: number, view: viewModule.AppView) {
   if (isBlank(contextView)) {
     contextView = parentView;
     contextBoundElementIndex = boundElementIndex;
   }
   parentView.changeDetector.addChild(view.changeDetector);
   var viewContainer = this._getOrCreateViewContainer(parentView, boundElementIndex);
   ListWrapper.insert(viewContainer.views, atIndex, view);
   var sibling;
   if (atIndex == 0) {
     sibling = null;
   } else {
     sibling = ListWrapper.last(viewContainer.views[atIndex - 1].rootElementInjectors)
   }
   var elementInjector = contextView.elementInjectors[contextBoundElementIndex];
   for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) {
     if (isPresent(elementInjector.parent)) {
       view.rootElementInjectors[i].linkAfter(elementInjector.parent, sibling);
     } else {
       contextView.rootElementInjectors.push(view.rootElementInjectors[i]);
     }
   }
 }
开发者ID:cedriclam,项目名称:angular,代码行数:26,代码来源:view_manager_utils.ts

示例2: AppViewContainer

 .andCallFake((parentView, elementIndex, _a, _b, atIndex, childView) => {
   var viewContainer = parentView.viewContainers[elementIndex];
   if (isBlank(viewContainer)) {
     viewContainer = new AppViewContainer();
     parentView.viewContainers[elementIndex] = viewContainer;
   }
   ListWrapper.insert(viewContainer.views, atIndex, childView);
 });
开发者ID:SnackyPete,项目名称:angular,代码行数:8,代码来源:view_manager_spec.ts

示例3: it

 it('should support insertions/moves', () => {
   l = ['a', 'a', 'b', 'b'];
   changes.check(l);
   ListWrapper.insert(l, 0, 'b');
   changes.check(l);
   expect(changes.toString()).toEqual(iterableChangesAsString({
     collection: ['b[2->0]', 'a[0->1]', 'a[1->2]', 'b', 'b[null->4]'],
     previous: ['a[0->1]', 'a[1->2]', 'b[2->0]', 'b'],
     additions: ['b[null->4]'],
     moves: ['b[2->0]', 'a[0->1]', 'a[1->2]']
   }));
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:12,代码来源:iterable_changes_spec.ts

示例4: insert

 insert(view, atIndex = -1) {
   if (atIndex == -1)
     atIndex = this._views.length;
   ListWrapper.insert(this._views, atIndex, view);
   if (isBlank(this._lightDom)) {
     ViewContainer.moveViewNodesAfterSibling(this._siblingToInsertAfter(atIndex), view);
   } else {
     this._lightDom.redistribute();
   }
   this.parentView.changeDetector.addChild(view.changeDetector);
   this._linkElementInjectors(view);
   return view;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:13,代码来源:view_container.ts

示例5: BaseException

 this._selectorMatcher.match(cssSelector, (selector, directiveIndex) => {
   elementBinder = current.bindElement();
   var directive = this._directives[directiveIndex];
   if (directive.type === DirectiveMetadata.COMPONENT_TYPE) {
     // components need to go first, so it is easier to locate them in the result.
     ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex);
     if (isPresent(componentDirective)) {
       throw new BaseException(
           `Only one component directive is allowed per element - check ${current.elementDescription}`);
     }
     componentDirective = directive;
     elementBinder.setComponentId(directive.id);
   } else {
     ListWrapper.push(foundDirectiveIndices, directiveIndex);
   }
 });
开发者ID:baraksu,项目名称:angular,代码行数:16,代码来源:directive_parser.ts

示例6: mergeChildComponentProtoViews

 mergeChildComponentProtoViews(protoViews, target) {
   var elementBinders = ListWrapper.createFixedSize(this.elementBinders.length);
   for (var i = 0; i < this.elementBinders.length; i++) {
     var eb = this.elementBinders[i];
     if (isPresent(eb.componentId) || isPresent(eb.nestedProtoView)) {
       elementBinders[i] = eb.mergeChildComponentProtoViews(protoViews, target);
     } else {
       elementBinders[i] = eb;
     }
   }
   var result = new ProtoView({
     elementBinders: elementBinders,
     element: this.element,
     isRootView: this.isRootView
   });
   ListWrapper.insert(target, 0, result);
   return result;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:18,代码来源:proto_view.ts

示例7: insert

 insert(view, atIndex = -1) {
   this._checkHydrated();
   if (atIndex == -1)
     atIndex = this._views.length;
   ListWrapper.insert(this._views, atIndex, view);
   if (!view.hydrated()) {
     view.hydrate(this._hostLightDom);
   }
   if (isBlank(this._lightDom)) {
     ViewContainer.moveViewNodesAfterSibling(this._siblingToInsertAfter(atIndex), view);
   } else {
     this._lightDom.redistribute();
   }
   if (isPresent(this._hostLightDom)) {
     this._hostLightDom.redistribute();
   }
   return view;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:18,代码来源:view_container.ts


注:本文中的angular2/src/facade/collection.ListWrapper.insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。