本文整理汇总了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))