Starting with the "Controller as" syntax is key to understanding AngularJS development. While you may come across examples using $scope, it's no longer the recommended approach for binding controllers to views. For more information, refer to AngularJS.org's documentation on ngController.
Check out this Plunker demo: http://plnkr.co/edit/aydvXaJNXtzdVI1mh2I4?p=preview
Sample HTML:
<!DOCTYPE html>
<html ng-app="controllerAsDemo">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c9a8a7aebca5a8bbe7a3ba89f8e7fde7b1">[email protected]</a>" src="https://code.angularjs.org/1.4.0-rc.2/angular.js" data-semver="1.4.0-rc.2"></script>
<script src="app.js"></script>
</head>
<body >
<p ng-controller="MainController as main">Hello {{main.name}}!</p>
<p ng-controller="BillyGoatController as billyGoat">Hello {{billyGoat.name}}!</p>
</body>
</html>
JavaScript code:
var app = angular.module('controllerAsDemo', []);
app.controller('MainController', function() {
this.name = 'World';
});
app.controller('BillyGoatController', function() {
this.name = 'Billy Goat Gruff';
})