서비스에서 지시문을 호출하려고합니다. 모든 것을 구현했지만 서비스 범위가 비어 있습니다. 일반적으로 내 함수는 컨트롤러에서 지시문을 호출합니다. 그러나 이러한 기능은 이제 여러 컨트롤러에서 필요하므로 서비스에 추가하려고합니다. 문제는 내 서비스가 지시문을 서비스에 종속성 주입 한 후에도 지시문에서 함수를 볼 수 없다는 것입니다.서비스에서 지시문을 호출하십시오. angularjs + typescript
export interface MyServiceScope extends IScope, directives.MyPanelScope, directives.MyPanelMenuScope {
// a bunch of properties that are not visible in the service scope, only the controller
}
// constructor here, controller does not initialize directives here just in interface and it works fine.
public serviceFunc() {
this.scope.panel.directiveFunc({ // directiveFunc undefined in service, but not in controller
template: "some/html/template",
data: {
item: data
}
});
}
그래서 서비스를 가져 와서 지침을보고 기능을 호출하는 방법은 무엇입니까?
서비스의 지시문을 호출 할 수 없습니다. 지시어를 삽입 할 수 없으므로 – PSL