當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript IQService.defer方法代碼示例

本文整理匯總了TypeScript中angular.IQService.defer方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IQService.defer方法的具體用法?TypeScript IQService.defer怎麽用?TypeScript IQService.defer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular.IQService的用法示例。


在下文中一共展示了IQService.defer方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: spyOn

 spyOn(literatureService, "getLitOrdersByUsername").and.callFake(() => {
     const deferred: IDeferred<any> = $q.defer();
     deferred.resolve([
         {
             "LitOrdersID": 8,
             "OrderStatus": "Submitted",
             "UserName": "siteadmintestcom",
             "OrderDate": "2017-02-01T16:20:00",
             "OrderNum": 2,
             "Revision": 7,
             "TotalCost": null,
             "GroupName": "SiteAdmin"
         },
         {
             "LitOrdersID": 9,
             "OrderStatus": "Completed",
             "UserName": "litordertestcom",
             "OrderDate": "2017-02-01T16:20:00",
             "OrderNum": 3,
             "Revision": 1,
             "TotalCost": null,
             "GroupName": "LitOrder"
         }
     ]);
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:26,代碼來源:manage-orders.controller.spec.ts

示例2: spyOn

 spyOn(literatureService, "getLitItemsForStockist").and.callFake(() => {
     const deferred: IDeferred<any> = $q.defer();
     deferred.resolve([
         {
             "LitItemsID": 1,
             "ItemName": "Hope Faith & Courage",
             "SalePrice": 7.0,
             "QuantityInStock": 0,
             "QuantityReserved": 0,
             "ItemTypeDescription": "Books",
             "ImageFilename": "BOOKS_HFC",
             "ItemType": "BOOKS",
             "Multiple": 1,
             "Active": true
         },
         {
             "LitItemsID": 2,
             "ItemName": "Hope Faith & Courage 2",
             "SalePrice": 7.14,
             "QuantityInStock": 231,
             "QuantityReserved": 20,
             "ItemTypeDescription": "Books",
             "ImageFilename": "BOOKS_HFC2",
             "ItemType": "BOOKS",
             "Multiple": 1,
             "Active": true
         }
     ]);
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:30,代碼來源:literature-orders.controller.spec.ts

示例3: getAllEntityTags

  public getAllEntityTags(entityType: string, entityIds: string[]): IPromise<IEntityTags[]> {
    if (!entityIds || !entityIds.length) {
      return this.$q.when([]);
    }
    const idGroups: string[] = this.collateEntityIds(entityType, uniq(entityIds));
    const succeeded = (val: IEntityTags[]) => val !== null;
    const sources = idGroups.map(idGroup => this.retryService.buildRetrySequence<IEntityTags[]>(
      () => this.API.one('tags')
        .withParams({
          entityType: entityType.toLowerCase(),
          entityId: idGroup
        }).getList(),
      succeeded, 1, 0)
    );

    const result: IDeferred<IEntityTags[]> = this.$q.defer();

    this.$q.all(sources).then(
      (entityTagGroups: IEntityTags[][]) => {
        const allTags: IEntityTags[] = this.flattenTagsAndAddMetadata(entityTagGroups);
        result.resolve(allTags);
      })
      .catch(() => {
        this.$exceptionHandler(new Error(`Failed to load ${entityType} entity tags; groups: \n${idGroups.join('\n')}`));
        result.resolve([]);
      });

    return result.promise;
  }
開發者ID:brujoand,項目名稱:deck,代碼行數:29,代碼來源:entityTags.read.service.ts

示例4: spyOn

 spyOn(loginService, "attemptLogin").and.callFake(() => {
     const deferred: IDeferred<ILoginError> = $q.defer();
     deferred.reject({data: {
         error: "invalid_something"
     }});
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:7,代碼來源:login.controller.spec.ts

示例5: getAllEntityTags

  public getAllEntityTags(entityType: string, entityIds: string[]): IPromise<IEntityTags[]> {
    if (!entityIds || !entityIds.length) {
      return this.$q.when([]);
    }
    const idGroups: ICollatedIdGroup[] = this.collateEntityIds(entityType, entityIds);
    const succeeded = (val: IEntityTags[]) => val !== null;
    const sources = idGroups.map(idGroup => this.retryService.buildRetrySequence<IEntityTags[]>(
      () => this.API.one('tags')
        .withParams({
          entityType: entityType.toLowerCase(),
          entityId: idGroup.entityId,
          maxResults: idGroup.maxResults,
        }).getList(),
      succeeded, 1, 0)
    );

    const result: IDeferred<IEntityTags[]> = this.$q.defer();

    this.$q.all(sources).then(
      (entityTagGroups: IEntityTags[][]) => {
        const allTags: IEntityTags[] = this.flattenTagsAndAddMetadata(entityTagGroups);
        result.resolve(allTags);
      })
      .catch(() => {
        result.resolve([]);
      });

    return result.promise;
  }
開發者ID:jcwest,項目名稱:deck,代碼行數:29,代碼來源:entityTags.read.service.ts

示例6: spyOn

 spyOn(subPageService, "getSubpages").and.callFake(() => {
     const deferred: IDeferred<Array<IPageWithContent>> = $q.defer();
     deferred.resolve([
         {
             CAPagesID: 1,
             PageName: "page",
             PageTitle: "title",
             PageContent: "content",
             Status: "ACTIVE",
             Revision: 1,
             StatusDate: "2017-08-15 21:58",
             ContentType: "R",
             ImageFilename: "page.png"
         },
         {
             CAPagesID: 2,
             PageName: "page 2",
             PageTitle: "title 2",
             PageContent: "content 2",
             Status: "ACTIVE",
             Revision: 2,
             StatusDate: "2017-08-15 21:59",
             ContentType: "R",
             ImageFilename: "page2.png"
         }]);
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:27,代碼來源:stories-controller.spec.ts

示例7: getProfilePictureUrl

 public getProfilePictureUrl(userId) {
   const deferred = this.$q.defer();
   deferred.resolve("https://scontent.xx.fbcdn.net/hprofile-xpa1/v/t1.0-1/" +
     "c12.0.50.50/p57x57/114…_8891337119643731696_n.jpg?" +
     "oh=4541774c11459787bb5d9ad23d059770&oe=5798CB9E");
   return deferred.promise;
 }
開發者ID:hadithhouse,項目名稱:hadithhouse,代碼行數:7,代碼來源:facebook.offline.service.ts

示例8: spyOn

 spyOn(manageInventoryService, "getLitItems").and.callFake(() => {
     const deferred: IDeferred<any> = $q.defer();
     deferred.resolve([
         {
             LitItemsID: 1,
             ItemName: "Hope Faith & Courage",
             SalePrice: 7.0,
             QuantityInStock: 0,
             QuantityReserved: 0,
             ItemTypeDescription: "Books",
             ImageFilename: "BOOKS_HFC",
             ItemType: "BOOKS",
             Multiple: 1,
             Active: true
         },
         {
             LitItemsID: 2,
             ItemName: "Hope Faith & Courage 2",
             SalePrice: 7.14,
             QuantityInStock: 231,
             QuantityReserved: 20,
             ItemTypeDescription: "Books",
             ImageFilename: "BOOKS_HFC2",
             ItemType: "BOOKS",
             Multiple: 1,
             Active: true
         }
     ]);
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:30,代碼來源:manage-inventory.controller.spec.ts

示例9: spyOn

 spyOn(dataService, "getData").and.callFake(() => {
     const deferred: IDeferred<any> = $q.defer();
     deferred.resolve({
         Environment: "Debug",
         Version: "3.7.0"
     });
     return deferred.promise;
 });
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:8,代碼來源:ca-environment-indicator.service.spec.ts


注:本文中的angular.IQService.defer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。