A
A
Abc Edc2015-07-17 22:19:48
Angular
Abc Edc, 2015-07-17 22:19:48

How to subscribe to filter value changes in a directive?

From the main controller to smaller filters that divide the directives among themselves, not through watch, but in a more beautiful way

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-07-17
@gleber1

1) directives can communicate through controllers (read about the require attribute of a directive)
2) handlers can be specified through attributes:

{
    scope: {
         onChange: '&'
    },
    link: function (scope, el, attr, ctrl) {
         ctrl.onChange(function (filter) {
             scope.onChange({filter: filter});
         });
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question