本文整理匯總了TypeScript中services/api.ApiService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ApiService類的具體用法?TypeScript ApiService怎麽用?TypeScript ApiService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ApiService類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(api: ApiService, config: Configuration) {
api.getUser(config.userId).then(user => this.user = user)
}
示例2: constructor
constructor(api: ApiService, config: Configuration) {
api.getPosts(config.userId)
.then(posts => this.posts = posts);
}
示例3: activate
activate(params: any) {
return this.api.getAlbum(Number(params.id))
.then(album => this.album = album)
.then(album => this.api.getPhotos(album))
.then(photos => this.photos = photos);
}
示例4: submit
submit(event: Event): void {
let button = event.srcElement;
button.setAttribute("disabled", "disabled");
let comment: Comment = {
body: this.comment,
email: this.email,
name: this.name,
postId: this.postId,
id: 0
};
let evt = DOM.createCustomEvent('save', { bubbles: true, detail: comment });
this.api.saveComment(comment)
.then(_ => this.element.dispatchEvent(evt))
.then(_ => this.reset())
.then(_ => button.removeAttribute("disabled"));
}
示例5: activate
activate(params: Params, routeConfig: RouteConfig, navigationInstruction: NavigationInstruction) {
this.api.getPost(Number(params.id))
.then(post => this.post = post);
this.api.getComments(Number(params.id))
.then(comments => this.comments = comments);
}
示例6: activate
activate() {
return this.api.getAlbums(this.userId)
.then(albums => this.albums = albums);
}
示例7:
.then(album => this.api.getPhotos(album))