Short demo about how angular provides a rich way to provide two-way data binding.
Created
October 17, 2014 00:44
-
-
Save arodbits/9a934006f2605b9f6fba to your computer and use it in GitHub Desktop.
A Pen by Anthony.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Indicating angular whar is our rootScope [myApp] --> | |
<div ng-app="myApp"> | |
<!--Using the defined scope in testController--> | |
<div ng-controller="testController"> | |
{{user.name}} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creating a new module | |
var app = angular.module('myApp',[]); | |
// Creating our testController - *Injecting the $scope object | |
app.controller('testController', function($scope){ | |
//Creating an emty user object | |
var user = {}; | |
user.name = "Steve"; | |
// Adding the user object to our scope. The scope is defined by the controller. | |
$scope.user = user; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment