how do you get <div> value using angularjs? example <div id="text">Text</div> -
how value using angular js?
how can text content using angularjs?
if got question right, mean ask how can set content in dom using angularjs. explaining simple example here.
<div ng-app="" ng-controller="personcontroller"> first name: <input type="text" ng-model="firstname"><br> last name: <input type="text" ng-model="lastname"><br> <br> full name: <p>{{firstname + " " + lastname}}</p> </div> <script> function personcontroller($scope) { $scope.firstname= "john"; $scope.lastname= "doe"; } </script>
in angularjs initialize application ng-app, ng-controller defines scope, here personcontroller. in personcontroller defination settting 2 variable firstname , last name. these 2 set value can using "{{ }}". there many other ways of setting value recommend go through angular basic tutorials can understand better.
Comments
Post a Comment