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


TypeScript ObservableArray.push方法代码示例

本文整理汇总了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; 
    }
开发者ID:maya-z,项目名称:recycler-view-demo,代码行数:16,代码来源:main-view-model.ts

示例2: loaded

export function loaded (args:EventData){
    view = args.object;
    view.bindingContext = vm;
    observableTweets.push(fetchData().map(function(item){
        return new Observable(item);
    }));
};   
开发者ID:ignaciofuentes,项目名称:nativescript-twitterclone,代码行数:7,代码来源:list.ts

示例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."));
        }
    }
开发者ID:nativescript-toolbox,项目名称:fork_nativescript-ui-samples,代码行数:7,代码来源:selection-states-model.ts

示例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]));
     }
   }
 }
开发者ID:chimon2000,项目名称:nativescript-couchbase,代码行数:8,代码来源:list-view-model.ts

示例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/"));
            }
        }
    }
开发者ID:ignaciolarranaga,项目名称:nativescript-fresco,代码行数:9,代码来源:main-view-model.ts

示例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]);
             }
         }
     }
 }
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:11,代码来源:clear-search-bar.component.ts

示例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);
        }
      }
    });
开发者ID:NathanWalker,项目名称:nativescript-couchbase,代码行数:16,代码来源:list-view-model.ts

示例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));
	}
开发者ID:MantisWare,项目名称:nativescript-marketplace-demo,代码行数:21,代码来源:listview-reorder-model.ts

示例9:

 this.arrayItems.forEach(item => {
     this.myItems.push(item);
 });
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:3,代码来源:clear-search-bar.component.ts

示例10:

 this.usersService.getUsers().subscribe((array) => {
   this.users.push(...array);
 });
开发者ID:racketometer,项目名称:frontend-application,代码行数:3,代码来源:users.component.ts


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