user2239655
user2239655

Reputation: 840

AngularJS add function to scope

Hi I have annoying problem. I am trying to add two methods to $scope. And I am doing this right this:

function typeCtrl ($scope, $timeout) {    
  $scope.addType = function(){
      requestHelper.addType();
  };
  $scope.removeType = function(number){
      alert("asdasdsad");
      requestHelper.removeType(number);
  };
 };

And I am trying to call it this way:

<button id="addType" class="btn btn-primary glyphicon glyphicon-plus" ng-click="addType()"></button>
<button id="removeRequest" class="btn btn-danger glyphicon glyphicon-minus" ng-click="removeType(1)"></button>

A method addType() works correctly but angular not see removeType() method. Can you tell me whay I am doing wrong. Thanks for replies.

Upvotes: 0

Views: 3617

Answers (1)

user3050339
user3050339

Reputation: 36

Can it be because of no end-bracket on first button?

Upvotes: 2

Related Questions