AngularJS: Data Binding

In AngularJS data binding is very straight forward, you need to assign a model in the ng-model attribute and on your page you can read the model from anywhere on the page either by expressions or ng-model from another element.

<html ng-app="app.demo">
	<title>Learn AngularJS - Data Binding</title>
	<script src=""></script>
	<script src="AppController.js"></script>
<body ng-controller="AppController">
	<input type="text" ng-model="message" />

Above is an example of an input element taking a message as a model and then display the message result with double curly braces. The message model comes from the┬ácontroller’s $scope eg. $scope.message.

.controller("AppController", ["$scope", function($scope){
	$scope.message="default message";

You can download the original source code from GitHub: