本文整理汇总了TypeScript中data/observable-array.ObservableArray.push方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableArray.push方法的具体用法?TypeScript ObservableArray.push怎么用?TypeScript ObservableArray.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data/observable-array.ObservableArray
的用法示例。
在下文中一共展示了ObservableArray.push方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getPersons
private getPersons() : ObservableArray<Person> {
var data = new ObservableArray<Person>();
for (var i = 0; i < 30; i++) {
if(i % 2 == 0)
{
data.push(new Person(i, "John Doe ", false));
}
else
{
data.push(new Person(i, "Jessica Donovan", true));
}
}
return data;
}
示例2: loaded
export function loaded (args:EventData){
view = args.object;
view.bindingContext = vm;
observableTweets.push(fetchData().map(function(item){
return new Observable(item);
}));
};
示例3: initDataItems
private initDataItems() {
this._items = new ObservableArray<DataItem>();
for (var i = 0; i < 25; i++) {
this._items.push(new DataItem(i, "Item " + i, "This is item description."));
}
}
示例4: refresh
private refresh() {
var rows = this.database.executeQuery("people");
for (var i in rows) {
if (rows.hasOwnProperty(i)) {
this.personList.push(JSON.parse(rows[i]));
}
}
}
示例5: initDataItems
private initDataItems() {
if (!this._dataItems) {
this._dataItems = new ObservableArray<DataItem>();
for (var i = 1; i <= 50; i++) {
this._dataItems.push(new DataItem(i, "http://lorempixel.com/400/200/"));
}
}
}
示例6: onSubmit
public onSubmit(value) {
this.myItems = new ObservableArray<DataItem>();
let searchValue = value.toLowerCase();
if (value !== "") {
for (let i = 0; i < this.arrayItems.length; i++) {
if (this.arrayItems[i].name.toLowerCase().indexOf(searchValue) !== -1) {
this.myItems.push(this.arrayItems[i]);
}
}
}
}
示例7:
this.database.addDatabaseChangeListener((changes) => {
var changeIndex;
for (var i = 0; i < changes.length; i++) {
var documentId;
documentId = changes[i].getDocumentId();
changeIndex = this.indexOfObjectId(documentId, this.personList);
var document = this.database.getDocument(documentId);
if (changeIndex == -1) {
this.personList.push(document);
} else {
this.personList.setItem(changeIndex, document);
}
}
});
示例8: preparePictures
private preparePictures() {
this._todoItems.push(new ListItem("Call Brian Ingram regarding the hotel reservations", false, false));
this._todoItems.push(new ListItem("See weather forecast for London", true, false));
this._todoItems.push(new ListItem("Prepare the children's documents", false, false));
this._todoItems.push(new ListItem("Check the Paris - London trains schedule", true, false));
this._todoItems.push(new ListItem("Ask Jonah if he will take care of the dog", false, false));
this._todoItems.push(new ListItem("Reschedule airplane tickets for the next month's flight to Hawaii", false, false));
this._todoItems.push(new ListItem("Bills due: Alissa's ballet class fee", false, false));
this._shoppingList.push(new ListItem("Milk", false, false));
this._shoppingList.push(new ListItem("Salmon", true, false));
this._shoppingList.push(new ListItem("Eggs", false, false));
this._shoppingList.push(new ListItem("Almonds", true, false));
this._shoppingList.push(new ListItem("Chicken", false, false));
this._shoppingList.push(new ListItem("Beef", false, false));
this._shoppingList.push(new ListItem("Yogurt", false, false));
this._shoppingList.push(new ListItem("Spinach", false, false));
this._shoppingList.push(new ListItem("Carrots", true, false));
this._shoppingList.push(new ListItem("Apples", false, false));
this._shoppingList.push(new ListItem("Tomatoes", true, false));
}
示例9:
this.arrayItems.forEach(item => {
this.myItems.push(item);
});
示例10:
this.usersService.getUsers().subscribe((array) => {
this.users.push(...array);
});