Skip to content

Instantly share code, notes, and snippets.

@drawveloper
Created February 21, 2016 12:58
Show Gist options
  • Save drawveloper/5f258317f54113c41ae1 to your computer and use it in GitHub Desktop.
Save drawveloper/5f258317f54113c41ae1 to your computer and use it in GitHub Desktop.
// View (a template)
<div ng-controller=”HelloController as hello”>
<label>Name:</label>
<input type=”text” ng-model=”hello.firstName”>
<input type=”text” ng-model=”hello.lastName”>
<h1>Hello {{hello.fullName()}}!</h1>
</div>
// Controller
angular.module(‘helloApp’, [])
.controller(‘HelloController’, function() {
var hello = this;
hello.fullName = function() {
return hello.firstName + hello.lastName;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment