feat(module-template): add a sample request to module's service

pull/4457/head
mehmet-erim 5 years ago
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);
}
}

@ -6,10 +6,8 @@ import { MyProjectNameComponent } from './components/my-project-name.component';
const routes: Routes = [
{
path: '',
component: DynamicLayoutComponent,
children: [
{ path: '', pathMatch: 'full', component: MyProjectNameComponent },
],
pathMatch: 'full',
component: MyProjectNameComponent,
},
];

@ -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…
Cancel
Save