mirror of https://github.com/abpframework/abp.git
3 changed files with 18 additions and 16 deletions
@ -1,20 +1,15 @@ |
|||||
import { Component, OnInit } from '@angular/core'; |
import { Component, OnInit } from '@angular/core'; |
||||
|
import { MyProjectNameService } from '../services/my-project-name.service'; |
||||
|
|
||||
@Component({ |
@Component({ |
||||
selector: 'lib-my-project-name', |
selector: 'lib-my-project-name', |
||||
template: ` |
template: ` <p>my-project-name works!</p> `, |
||||
<p> |
styles: [], |
||||
my-project-name works! |
|
||||
</p> |
|
||||
`,
|
|
||||
styles: [ |
|
||||
] |
|
||||
}) |
}) |
||||
export class MyProjectNameComponent implements OnInit { |
export class MyProjectNameComponent implements OnInit { |
||||
|
constructor(private service: MyProjectNameService) {} |
||||
constructor() { } |
|
||||
|
|
||||
ngOnInit(): void { |
ngOnInit(): void { |
||||
|
this.service.sample().subscribe(console.log); |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,9 +1,18 @@ |
|||||
import { Injectable } from '@angular/core'; |
import { Injectable } from '@angular/core'; |
||||
|
import { RestService } from '@abp/ng.core'; |
||||
|
|
||||
@Injectable({ |
@Injectable({ |
||||
providedIn: 'root' |
providedIn: 'root', |
||||
}) |
}) |
||||
export class MyProjectNameService { |
export class MyProjectNameService { |
||||
|
apiName = 'MyProjectName'; |
||||
|
|
||||
constructor() { } |
constructor(private restService: RestService) {} |
||||
|
|
||||
|
sample() { |
||||
|
return this.restService.request<void, any>( |
||||
|
{ method: 'GET', url: '/api/MyProjectName/sample' }, |
||||
|
{ apiName: this.apiName } |
||||
|
); |
||||
|
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue