M
M
Maxim Ivanov2016-10-19 14:08:01
Angular
Maxim Ivanov, 2016-10-19 14:08:01

How to call a function or listen for updates via the passed attribute state in a component?

I have for example a component

<div ng-controller="Main">
<component autorequest="true"></component>

<component autorequest="false" autoupdate="true"></component>

..
</div>

Conditionally, I have a collection in this component, there can be many such components, but only those in which true is present need to be updated, moreover, a specific component must send its requests if autorequest is set.
How can this be done in Angular?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Gerasimov, 2016-10-19
@splincodewd

Read about "$onChanges(changesObj)" in the AngularJS documentation .
In the component, watch the input data change and, given the right parameters, do what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question