Angular 5 — крючок жизненного цикла в директиве ⇐ Jquery
-
Anonymous
Angular 5 — крючок жизненного цикла в директиве
I am new to Angular 5.
I have created the directive for the external JS library.
But in the same directive, I am binding value to the attribute.
I am trying to sue ngAfterViewInit to detect whether all the values are bound to the attribute and then call the jQuery plugin.
But I have find life cycle hook only for the component. Can I use those in directive? Is that a good choice?
If I don't use ngAfterViewInit, then when I call jQuery plugin, the values are not bound.
If I use that, the attribute values are ready when I call the jQuery plugin.
Источник: https://stackoverflow.com/questions/487 ... -directive
I am new to Angular 5.
I have created the directive for the external JS library.
But in the same directive, I am binding value to the attribute.
I am trying to sue ngAfterViewInit to detect whether all the values are bound to the attribute and then call the jQuery plugin.
But I have find life cycle hook only for the component. Can I use those in directive? Is that a good choice?
If I don't use ngAfterViewInit, then when I call jQuery plugin, the values are not bound.
If I use that, the attribute values are ready when I call the jQuery plugin.
Источник: https://stackoverflow.com/questions/487 ... -directive
Мобильная версия