N
N
Nikolay2018-05-10 19:48:09
Angular
Nikolay, 2018-05-10 19:48:09

How to update the model when going to the page?

Hello!
Angular 1.6.9 question with enabled routing.
There is a "tree" of elements.
And on one of the pages we have code like this:

<a href="/#!/elements/{{ element.id }}/list">{{ element.name }}</a>

We need the model to change (the property is updated) when clicking on this link.
For example, if you change it like this:
<a ng-click="element.name='hello world'">{{ element.name }}</a>

That model name is updated - we have achieved the necessary behavior, but the truth does not follow the link - which is not good.
What is the way out of this situation? )
Thanks in advance :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2018-05-17
@iNickolay

A simple trick worked:

<a href="/#!/elements/{{ element.id }}/list" ng-click="Ctrl.treeNavigate(element)">
    {{ element.name }}
</a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question