0
我無法通過此指令調用我的服務。我使用帶有wizard.js的模板來製作嚮導模式窗體。我不確定這是否是一個角度2問題。如何從Angular 2的指令中調用服務
這裏是我的指令:
import {Directive,Input, EventEmitter, ElementRef, Output} from '@angular/core';
import {Injectable,Inject} from '@angular/core';
import {Service} from '../../../service/service';
@Directive ({
selector: '[bootstrap-application-wizard]',
providers:[DashboardService]
})
export class BootstrapApplicationWizard {
$el: any;
constructor(
private _service:Service){}
function render(){
wizard.on('submit', function(wizard): void {
this.submit = {'data1': 'John','data2': 'Doe'};
this._service.postData('data',this.submit).subscribe(x=>{
console.log('ok');
});
}
ngOnInit(){
this.render();
}
}
任何想法?