本文整理匯總了TypeScript中@angular/core.IterableDiffers類的典型用法代碼示例。如果您正苦於以下問題:TypeScript IterableDiffers類的具體用法?TypeScript IterableDiffers怎麽用?TypeScript IterableDiffers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IterableDiffers類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor (private _iterableDiffers: IterableDiffers) {
this.phrases = [];
this.phraseClick = new EventEmitter<Phrase>();
this.phrasesByCategory = [];
this.m_phrasesDiffer = this._iterableDiffers.find(this.phrases).create(null);
}
示例2: 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);
}
示例3: 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();
}
示例4: 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();
}
示例5: 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);
}
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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);
}
示例9: getTreeControlFunctionsMissingError
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());
}
示例10: getTreeControlFunctionsMissingError
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());
}