controller
Table of Contents
Description
Wraps the html in a controller.
Usage
as attribute
<ANY controller="{string}">
...
</ANY>
Parameters
Param | Type | Details |
---|---|---|
controller |
string |
The name of the controller. |
Example
Source
<div controller="ExampleController">
<p>{{foo}} <a href="javascript:void(0);" ng-click="alert()" styling="button">Alert!</a> </p>
</div>
<hr/>
<div controller="Example2Controller">
<p>{{bar}}</p>
</div>
angular.module('lightning')
.controller('ExampleController', ['$scope','$timeout', function($scope,$timeout) {
$scope.foo = 'bar';
$scope.alert = function(){
alert('Hello World!')
};
}])
.controller('Example2Controller', ['$scope','$timeout', function($scope,$timeout) {
$scope.bar = 'foo';
}]);