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


TypeScript Apollo.query方法代碼示例

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


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

示例1: getPage

 getPage(paging) {
   return this.apollo.query({
     query: getPage,
     variables: { offset: paging.offset, first: paging.first },
     fetchPolicy: 'no-cache'
   });
 }
開發者ID:ngocdiep,項目名稱:nd,代碼行數:7,代碼來源:post.service.ts

示例2: ngOnInit

 ngOnInit() {
   this.author$ = this.apollo
     .query<any>({
       query: authorQuery,
       variables: {
         id: 2,
       },
       fetchPolicy: 'network-only',
     })
     .pipe(map(result => result.data.author));
 }
開發者ID:kamilkisiela,項目名稱:apollo-angular-lazy-modules,代碼行數:11,代碼來源:foo.component.ts

示例3: constructor

 constructor(apollo: Apollo) {
   this.say$ = apollo
     .query<any>({
       query: gql`
         {
           hello
         }
       `,
     }).pipe(
         map(result => result.data.hello)
     )
 }
開發者ID:Urigo,項目名稱:angular-meteor,代碼行數:12,代碼來源:app.component.ts

示例4: filter

 filter(pattern: string) {
   return this.apollo.query({
     query: gql`
     query {
       allTags {
         nodes {
           id
           name
         }
       }
     }`,
     fetchPolicy: 'no-cache'
   });
 }
開發者ID:ngocdiep,項目名稱:nd,代碼行數:14,代碼來源:tag.service.ts

示例5: getComments

 getComments(postId: number, parentId: Number, offset: number, first: number, offsetReplies: number, firstReplies: number) {
   return this.apollo.query({
     query: gql`
       query ($postId: Int, $parentId: Int, $offset: Int, $first: Int, $offsetReplies: Int, $firstReplies: Int) {
         allPostComments(offset: $offset, first: $first, condition: {postId: $postId, parentId: $parentId}, orderBy: CREATED_AT_DESC) {
           totalCount
           pageInfo {
             hasNextPage
           }
           nodes {
             id
             content
             parentId
             postCommentsByParentId(offset: $offsetReplies, first: $firstReplies, orderBy: CREATED_AT_DESC) {
               totalCount
               pageInfo {
                 hasNextPage
               }
               nodes {
                 id
                 content
                 parentId
                 postCommentsByParentId {
                   totalCount
                   pageInfo {
                     hasNextPage
                   }
                 }
               }
             }
           }
         }
       }
     `,
     variables: {
       postId: postId,
       parentId: parentId,
       offset: offset,
       first: first,
       offsetReplies: offsetReplies,
       firstReplies: firstReplies
     }
   });
 }
開發者ID:ngocdiep,項目名稱:nd,代碼行數:44,代碼來源:post.service.ts

示例6: get

 get(query: string, options?: QueryOptions<any>): Observable<any> {
   // return this.http.get<any>(`/api/graph/?query=${CommonService.compressString(query)}`, options);
   return this.apollo.query<any>(Object.assign({ query: gql`${query}` }, options));
   // return this.apollo.watchQuery<any>(Object.assign({ query: gql`${query}` }, options)).valueChanges;
 }
開發者ID:OysteinAmundsen,項目名稱:gymsystems,代碼行數:5,代碼來源:graph.service.ts

示例7: get

 get(id: number) {
   return this.apollo.query({
     query: getById,
     variables: { id: id }
   });
 }
開發者ID:ngocdiep,項目名稱:nd,代碼行數:6,代碼來源:post.service.ts

示例8: getUserProfile

 getUserProfile() {
   return this.apollo.query({
     query: getUserProfile
   });
 }
開發者ID:ngocdiep,項目名稱:nd,代碼行數:5,代碼來源:profile.service.ts


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