Advertisement
Guest User

Untitled

a guest
Jan 24th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             $scope.postTopic = function(){
  2.                 var q = $q.defer();
  3.                 var top = topicService.post($scope.topicName, $scope.topicDescription)
  4.                 q.resolve(top);
  5.                 return q.promise;
  6.             }
  7.  
  8.             $scope.createNewTopic = function() {
  9.  
  10.                
  11.  
  12.                 if ($scope.topicName && $scope.topicDescription) {
  13.                    
  14.                     var tmp = $scope.postTopic();
  15.  
  16.                     console.log('tmp' + tmp);
  17.  
  18.                     tmp.then(function (data){
  19.                         console.log('taaa' + data);
  20.                         $scope.search(data, true);
  21.                     })
  22.                 }
  23.                 else {
  24.                     alert('Enter valid input');
  25.                 }
  26.                 $scope.topicName = "";
  27.                 $scope.topicDescription = " ";
  28.                 $scope.showTopicForm = false;
  29.             };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement