0

I have ng:repeat, created by json (methods), inside it creates a series of radio buttons that are characterized by iteration (method).

Below, I need to create a variable that will be based on method selected radio button, for use in the future. I will prepare the template for clarity.

<li ng:repeat="method in methods">
  <label>
    <input type="radio" ng:model="$parent.deliveryMethod" ng:value="method" />
  </label>
</li>

<table ng:init="myValue = deliveryMethod.price | format">
  <tr>
    <td ng:bind="myValue"></td>
  </tr>
</table>

I hope the point is clear. The problem is, as I understand it, ng:init is triggered earlier than time to form methods.

What I must to do?

Thanks!

1 Answer 1

1

You're syntax looks incorrect , You should be declaring ng- as listed below :

ng-repeat
ng-model
ng-init
ng-bind

ect...

docs here: https://docs.angularjs.org/api/ng/directive/ngRepeat

upadte - to apply method to radio button try ng-change :

ng-change="dosomething()"
Sign up to request clarification or add additional context in comments.

2 Comments

Hm, in one book about Angular, I read about three different three options for naming directives, is like "ng-directive", "ng:directive" or "data-ng-directive", about third I don't sure. So, maybe you're right about "ng-init", but it option of ":" is working in different case. (sorry for my English.)
@KpTheConstructor technically :/_/- should work, as they are taken care by directive normalization process, look at here..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.