javascript - How do you call an Angular $scope.Function from href? -


the following works call function activechange(variable)

a(href="javascript: activechange('topstories');") top stories 

but if function defined angualr $scope function such

function activecontroller ($scope) {         $scope.topstories='active';     $scope.mostrecent='lucky';     $scope.activechange =   function (activetab) {         if(activetab=='topstories'){             var x=document.getelementbyid("someinput");             x.value='happy alive';             $scope.topstories='active';             $scope.mostrecent='';         }         else {                   alert('else');             $scope.topstories='happy';             $scope.mostrecent='active';         }     } } 

how call $scope.activechange = function (activetab) ?

just use ngclick @mike says. don't see reason use angular in href .

something like:

<a href="" ng-click="activechange('topstories');">top stories</a> 

or leave empty:

<a href ng-click="activechange('topstories');">top stories</a> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -