Ngxi4DynamicService
This library was generated by Doan Quoc Cuong (cuongdq.payment@gmail.com) with Angular CLI version 8.2.13.
Install:
Run npm install ngxi4-dynamic-service --save
to get service for using.
Use:
1. add in ./app.module.ts
import { Ngxi4DynamicServiceModule } from 'ngxi4-dynamic-service'
@NgModule({
// ...
imports: [
// ....
// add module ngxi4-dynamic-service
Ngxi4DynamicServiceModule.forRoot()
// or define authServerUrl link to your api server
// Ngxi4DynamicServiceModule.forRoot({ authServerUrl: 'https://xyz.com/auth'})
]
})
2. add in ./home.module.ts:
import { Ngxi4DynamicServiceModule } from 'ngxi4-dynamic-service'
@NgModule({
// ...
imports: [
// ....
// add module ngxi4-dynamic-service
Ngxi4DynamicServiceModule
]
})
3. Use for services in ./home.page.ts
import { AuthService, CommonsService } from 'ngxi4-dynamic-service';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage implements OnInit{
constructor(
private apiAuth: AuthService
, private apiCommon: CommonsService
) {}
ngOnInit() {
this.apiAuth.getDynamicUrl(this.apiAuth.serviceUrls.AUTH_SERVER + "/captcha-token")
.then(data => {
console.log('data', data);
})
.catch(err => {
console.log('error', err);
this.apiCommon.presentAlert('Error', err.message);
})
}
}