Answer the question
In order to leave comments, you need to log in
How to get model in directive?
When initialized, the model makes a request to the server and receives data. This data must be parsed in the directive in order to build a dynamic menu. How should the model get into the directive? If it has to get into the directive through the controller of the directive, how should it get into it? And I have heard more than once that using ngRepeat in a template directive is bad, just like having both a controller and a link at the same time. This makes my brain explode.
Answer the question
In order to leave comments, you need to log in
This data must be parsed in the directive in order to build a dynamic menu.
class FooController {
constructor(fooService) {
this.fooService = fooService;
}
}
return {
controller: FooController,
controllerAs: 'vm',
link: function (scope, el, attr, ctrl) {
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question