Skip to content

Instantly share code, notes, and snippets.

@arodbits
Created October 17, 2014 00:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arodbits/9a934006f2605b9f6fba to your computer and use it in GitHub Desktop.
Save arodbits/9a934006f2605b9f6fba to your computer and use it in GitHub Desktop.
A Pen by Anthony.

Hello Angularjs

Short demo about how angular provides a rich way to provide two-way data binding.

A Pen by Anthony on CodePen.

License.

<!-- 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>
//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