-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·26 lines (23 loc) · 780 Bytes
/
app.js
File metadata and controls
executable file
·26 lines (23 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var myApp = angular.module('myApp', []);
myApp.controller('myController', function($scope) {
$scope.model = { float: 'World' };
$scope.float = 0.27;
});
myApp.directive('myDirective', function($compile) {
var directive = {};
directive.restrict = 'E';
directive.scope = {
myDirectiveVar: '='
};
directive.template = function() {
var response = "(((myDirectiveVar >=0) && (myDirectiveVar <= 1)) ? ('Percentage: ' + (myDirectiveVar * 100) + '%') : 'ERROR: The given float is an invalid number')";
return '<div class="some">' +
'<p ng-bind="' + response + '"></p></div>'
};
directive.replace = true;
//require: 'ngModel',
directive.link = function($scope, elem, attr, ctrl) {
console.debug($scope);
};
return directive;
});