Angular: Inheritance example
by Zmetser
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<pre>foo: {{foo}}</pre>
<pre>bar: {{bar}}</pre>
<div ng-controller="MyCtrl2">
<pre>foo: {{foo}}</pre>
<pre>bar: {{bar}}</pre>
<button ng-click="callMe()">Click!</button>
</div>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.controller('MyCtrl', function ($scope) {
$scope.foo = "foo";
$scope.callMe = function(){
alert('PINA!')
}
});
myApp.controller('MyCtrl2', function ($scope) {
$scope.bar = "bar";
});