javascript - Binding text inputs to a directives attribute -


I am trying to force a text input to an attribute within an instruction, the reason is that I do not want every time I add a new instruction like this, to present the controller. Is it also possible or do you always have to specify the controller while using the NG-model. Example of code is equal to thousand words, please take a look. As you type input, the amount should be changed.

There are two problems with your code:

  1. < code> scope $ Watch (attrs.amount, function (v) {...}); & lt; = & Gt;
    scope $ watch ('100', function (v) {...});
    Whoever is not going to change, does not do what you want.

  2. Since element attribute will never change, function draw (anime) {var zodiac = etter.mount; Not very useful.


    You can fix them like this:

      area. $ watch ('zodiac', function (v) {...});   

    and

      function draw (anime) {var zodiac = scope.mount; ...   

    Also see .


    If you need to set up two-way data-binding in the field of parent, and to force the property to be specified in the parent area . Ex:

      // $ scope.someAmount = 100 of parental scope; // in HTML & lt; custommarc zodiac = "someAmount" ... // In the Director area: {amount: '=' ...   



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -