mirror of https://github.com/abpframework/abp
parent
ea3aaccce8
commit
60dcdf20e5
@ -1,20 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MyProjectNameService } from '../services/my-project-name.service';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-my-project-name',
|
||||
template: `
|
||||
<p>
|
||||
my-project-name works!
|
||||
</p>
|
||||
`,
|
||||
styles: [
|
||||
]
|
||||
template: ` <p>my-project-name works!</p> `,
|
||||
styles: [],
|
||||
})
|
||||
export class MyProjectNameComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private service: MyProjectNameService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.service.sample().subscribe(console.log);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RestService } from '@abp/ng.core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
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