1

I want to use ng-model directive as element rather than as attribute inside tag,is there any way to do it?

well I've already designed my webpage in html and javascript and I want to include it in angularJS using "ng-include". So rather than adding attribute like,

<input type="checkbox" id="checkbox" name='rejectedPartsConfirmtodothis' ng-model="reject">

I want to put it in the format like, (as said in angulaJS documentation )

<ng-model>
<input --->
</ng-model>

but this is not working, any idea how can I make it work?

2
  • what did you want to do ? Commented Jun 23, 2016 at 10:05
  • This is just not possible right now with current angular version. Commented Jun 23, 2016 at 10:05

4 Answers 4

2

Quoting the content of the page

Usage

as element: (This directive can be used as custom element, but be aware of IE restrictions).

<ng-model>
...
</ng-model>
Sign up to request clarification or add additional context in comments.

2 Comments

@GSURENDARTHINA As you the timing of answer. Both are answered at same time. I'm not duplicating the answer.
Oh., okey! just asked, if it meant something here. I'm just getting used to sof. Thanks.
1

according to v1.5 official documentation : https://docs.angularjs.org/api/ng/directive/ngModel

Usage

as element: (This directive can be used as custom element, but be aware of IE restrictions).

<ng-model>
...
</ng-model>

Comments

0

I dont really think there would be a use case where you would really need to do this...instead try some alternative but use ng-model as an attribute as ng-model is a pre-defined directive given by angularjs...

Comments

0

You can build a new directive but you cannot modify ng-model to work as an element.

Comments

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.