Fill model data from controller

Description

The following code shows how to Fill model data from controller.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
var myApp = angular.module('myApp', []);
function myCtrl($scope){<!--from  ww w. j av a 2 s.com-->
    $scope.textInput = 'hi there';
}
</script>
</head>
<body>
  <div ng-app="myApp">
<div ng-controller="myCtrl">
    Textbox1:
    <input type="text" ng-model="textInput"/>
</div>
</div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities