I new to angular js. I want to implement with angular js.

Here is my code.

*index.html*

    <div class="container" ng-controller="headerController">
        <span ng-repeat="b in button" > 
             <button button-control id='{{b}}' ng-click = 
'{{b}}()'>{{b}}</button>
        </span>
    </div>

**app.js**

    .controller('headerController',function($scope,$location){
         $scope.button = ['prev','toggle','reserve','next'];
     })
    .directive('buttonControl',function(){
        return{
          restrict: 'AE',
          replace: true,
          link:function(scope,elem,attrs){
          var api = elem.spritespin('api');
          scope.prev = function(){               
           api.stopAnimation(); //*problem*
          }
          scope.toggle = function(){

          }
          scope.reserve = function(){

          }
          scope.next = function(){

          }
      }
    }
  })

*Problem*
when i do api.stopAnimation(), stopAnimation() uses this object which 
points to current scope instead of elem. I might  be wrong on this.

Any help appreciated

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to