-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
26 lines (26 loc) · 988 Bytes
/
app.js
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
angular.module('baliTrip', [])
.controller('MainCtrl', [
'$scope',
function($scope){
$scope.test = 'Partiu Bali';
$scope.posts = [];
$scope.addPost = function(){
if (!$scope.title || $scope.title === ''){
alert('Post sem titulo nao vale')
return;}
if (!$scope.description || $scope.description === ''){
alert('Post sem descriçao nao vale')
return;}
$scope.posts.push({title: $scope.title,
description: $scope.description,
link: $scope.link,
upvotes: 0});
$scope.title = '';
$scope.description = '';
$scope.link = '';
}
$scope.incrementUpvotes = function(post){
post.upvotes += 1;
}
}
]);