本文整理汇总了TypeScript中@angular/core.IterableDiffers.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IterableDiffers.find方法的具体用法?TypeScript IterableDiffers.find怎么用?TypeScript IterableDiffers.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.IterableDiffers
的用法示例。
在下文中一共展示了IterableDiffers.find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnChanges
ngOnChanges(changes: SimpleChanges): void {
if ("rawItems" in changes) {
const currentItems = changes.rawItems.currentValue;
if (!this._differ && currentItems) {
this._differ = this._differs.find(currentItems).create(this._items.trackBy);
}
}
}
示例2: constructor
constructor (private _iterableDiffers: IterableDiffers) {
this.phrases = [];
this.phraseClick = new EventEmitter<Phrase>();
this.phrasesByCategory = [];
this.m_phrasesDiffer = this._iterableDiffers.find(this.phrases).create(null);
}
示例3: ngOnChanges
ngOnChanges(changes: SimpleChanges): void {
// Create a new columns differ if one does not yet exist. Initialize it based on initial value
// of the columns property.
const columns = changes['columns'].currentValue;
if (!this._columnsDiffer && columns) {
this._columnsDiffer = this._differs.find(columns).create();
this._columnsDiffer.diff(columns);
}
}
示例4: ngOnChanges
ngOnChanges(changes: SimpleChanges): void {
// Create a new columns differ if one does not yet exist. Initialize it based on initial value
// of the columns property or an empty array if none is provided.
if (!this._columnsDiffer) {
const columns = (changes['columns'] && changes['columns'].currentValue) || [];
this._columnsDiffer = this._differs.find(columns).create();
this._columnsDiffer.diff(columns);
}
}
示例5: myDemo
// called once on initial load
@Input() set myDemo(items: string[]) {
console.log("set myDemo called");
this.items = items;
items.forEach(item => {
this.viewContainer.createEmbeddedView(this.templateRef);
});
this.differ = this.differs.find(items).create(this.changeDetector);
}
示例6: constructor
constructor(differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
this.comments = [];
this.authors = ['Elliot', 'Helen', 'Jenny', 'Joe', 'Justen', 'Matt'];
this.texts = [
'Ours is a life of constant reruns',
'Really cool!',
'Thanks!'
];
// setTimeout will trigger ngDoCheck
setTimeout(() => this.addComment(), 1000);
}
示例7: constructor
constructor(differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
this.comments = [];
this.authors = ['Elliot', 'Helen', 'Jenny', 'Joe', 'Justen', 'Matt'];
this.texts = [
"Ours is a life of constant reruns. We're always circling back to where we'd we started, then starting all over again. Even if we don't run extra laps that day, we surely will come back for more of the same another day soon.",
'Really cool!',
'Thanks!'
];
this.addComment();
}
示例8: ngAfterContentInit
ngAfterContentInit() {
this._dataDiffer = this._differs.find([]).create(this._tree.trackBy);
if (!this._tree.treeControl.getChildren) {
throw getTreeControlFunctionsMissingError();
}
this._tree.treeControl.getChildren(this.data).pipe(takeUntil(this._destroyed))
.subscribe(result => {
this._children = result;
this.updateChildrenNodes();
});
this.nodeOutlet.changes.pipe(takeUntil(this._destroyed))
.subscribe(() => this.updateChildrenNodes());
}
示例9: constructor
constructor(differs: IterableDiffers) {
this.differ = differs.find([]).create(null);
this.comments = [];
this.authors = ['Elliot', 'Helen', 'Jenny', 'Joe', 'Justen', 'Matt'];
this.texts = [
"I love Arsenal.",
"What is your name?",
"Awesome!"
];
this.addComment();
}
示例10: ngAfterContentInit
ngAfterContentInit() {
this._dataDiffer = this._differs.find([]).create(this._tree.trackBy);
if (!this._tree.treeControl.getChildren) {
throw getTreeControlFunctionsMissingError();
}
const childrenNodes = this._tree.treeControl.getChildren(this.data);
if (Array.isArray(childrenNodes)) {
this.updateChildrenNodes(childrenNodes as T[]);
} else if (childrenNodes instanceof Observable) {
childrenNodes.pipe(takeUntil(this._destroyed))
.subscribe(result => this.updateChildrenNodes(result));
}
this.nodeOutlet.changes.pipe(takeUntil(this._destroyed))
.subscribe(() => this.updateChildrenNodes());
}