angularjs - Declaring and using angular directives that map id, name, and ng-model to a single field -


I want to use / use an AngularJS instructions to avoid making some unnecessary HTML and to make it even easier For how do I use bootstrap elements. I want to use a command like this:

  & lt; MyDirective id = "person.lname" label = "last name" & gt; & Lt; / MyDirective & gt;   

The template I want AngularJS to write:

    

How do I declare a command to be able to create this template and binding with the NG-model still work?

Renamed

I added the label tag to it, reflect how the id / name will be used for the input element. The generated template will allow you to click on the label and the focus will be placed on the input element.

You should do this:

 . Directive ('my directive', function () {return: {model: '= identifier', id: 'identifier', label: "{{id}}"> {{label}}   

See:

  & lt; My-directional label = 'last name' identifier = "person.lname" & gt; & Lt; / My-directive & gt;   



Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -