Question on angular 1.6.9 with connected routing. There is a "tree" of elements. And on one of the pages we have a code like this:

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

We need to change the model when clicking on this link (the property is updated). 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 no good.
What is the way out of this situation? Thanks in advance :)

  • ng-click="$ctrl.updateNameAndRouteTransition(element)" - nörbörnën
  • @norbornen, if the href attribute is specified, then ng-click is not executed ( - Nikolay
  • I meant that you need to write a function that will change element.name and the transition will make - nörbörnën
  • I am trying to make a directive, but I do not understand how to update the model through it, do not tell me? ) - Nikolay
  • Well, I xs what problem you solve and the right tools. if you make a directive (which is not fashionable for a long time) then there is a bidirectional binding, if a component can be passed a function that you call when you click and change the model in it - nörbörnën

0