-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·34 lines (26 loc) · 815 Bytes
/
app.js
File metadata and controls
executable file
·34 lines (26 loc) · 815 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
27
28
29
30
31
32
33
34
var app = angular.module('myApp', []);
app.controller('myController', ['$scope', '$filter', '$http', function($scope, $filter, $http) {
$scope.handle = "";
$scope.lowercase = function(){
return $filter('lowercase')($scope.handle);
};
$scope.characters = 5;
$http.get('/api')
.success(function(result){
$scope.rule = result;
})
.error(function(data.status){
console.log(data);
});
$scope.newRule = "";
$scope.addRule = function(){
$http.post('/api', { newRule: $scope.newRule })
.success(function(result){
$scope.rules = result;
$scope.newRule = "";
})
.error(function(data,status){
console.log(data);
});
};
}]);