Inject $modal and accountIdService in Angular Component.

This commit is contained in:
Alexis Lahouze 2017-07-25 10:45:13 +02:00
parent 3c148e5297
commit 2166def0f1
2 changed files with 18 additions and 2 deletions

View File

@ -11,7 +11,6 @@ var scheduleFormTmpl = require('./schedule.form.tmpl.html'),
scheduleDeleteTmpl = require('./schedule.delete.tmpl.html'); scheduleDeleteTmpl = require('./schedule.delete.tmpl.html');
export class ScheduleComponent { export class ScheduleComponent {
$modal: any;
accountId: number; accountId: number;
operations = []; operations = [];

View File

@ -14,6 +14,14 @@ import { ScheduleService } from './schedule.service';
import { ScheduleDeleteModalComponent } from './scheduleDeleteModal.component'; import { ScheduleDeleteModalComponent } from './scheduleDeleteModal.component';
import { ScheduleRowComponent } from './scheduleRow.component'; import { ScheduleRowComponent } from './scheduleRow.component';
export function $modalServiceFactory(i: any) {
return i.get('$modal');
}
export function accountIdServiceFactory(i: any) {
return i.get('accountIdService');
}
@NgModule({ @NgModule({
imports: [ imports: [
HttpModule, HttpModule,
@ -25,7 +33,16 @@ import { ScheduleRowComponent } from './scheduleRow.component';
NgbModule NgbModule
], ],
providers: [ providers: [
ScheduleService ScheduleService,
{
provide: '$modal',
deps: ['$injector'],
useFactory: $modalServiceFactory
}, {
provide: 'accountIdService',
deps: ['$injector'],
useFactory: accountIdServiceFactory
}
], ],
declarations: [ declarations: [
ScheduleDeleteModalComponent, ScheduleDeleteModalComponent,