У меня есть это:
// child component
this.$onChanges = () => {
console.log(this.test);
}
// parent component
$scope.test = {
team: "barcelona"
};
// parent component html
<my-component test="test"></my-component>
// parent component
$timeout(() => {
$scope.test.team = "Real madrid"; // NOT fire the $onChanges!
$scope.test = {
team: "Real madrid";
} // DOES fire the $onChanges!
}, 2000);
Как видите, функция компонентов $ onChanges запускается только при присваивании значения, а не просто при обновлении.
Что с этим делать?