I have defined the following element in angular JS

<input type="text" ng-model="username">

I can access it using $scope.username in controller etc. So far so good. 

How can I access it from using DOM model?

var elem = document.getElementById('username');   //does not work
elem.value = "Some value";
console.dir(elem);

var elem = document.getElementById('ng-model="username"'); //does not work
elem.value = "Some value";
console.dir(elem);

This may not be the recommended, but wish to know.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to