Angular - Module
Module with controller, filter, and directive.
by sramnan
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<body ng-app="myApp" ng-controller="myCtrl">
<input type = "text" ng-model = "name">
<my-name name="name" ></my-name>
</body>
JavaScript
// the main (app) module
var myApp = angular.module("myApp", []);
// add a controller
myApp.controller("myCtrl", function($scope) {
$scope.name = "sonia";
$scope.names = [{
name:"sonia"
},
{name:"karthik"}
];
});
// add a filter
myApp.directive("myName", function() {
return {
restrict: 'E',
scope:{
name:'='
},
template: 'My name is {{name}}'
};
});