javascript - Trying to generate a button-group with Bootsrap and AngularJS to redirect to different URLs -


i trying create button group of 2 (using bootstrap , angularjs) that, when clicking on them, each redirect different url. have following code (copied relevant pieces):

app.controller('linkcontroller',function(link, $scope, $location){      $scope.go = function(){  	$location.url(link);       };  });
<div class="btn-group btn-group-lg" data-ng-controller = "linkcontroller">      <button type="button" class="btn btn-primary" data-ng-click = "go('test1.html')">click1</button>      <button type="button" class="btn btn-primary" data-ng-click = "go('test2.html')">click2</button>  </div>  	

however, doesn't work, , not sure why. might not passing arguments correctly, tried without passing link , still didn't work. appreciate help!

are trying pass url ?, if so, :

app.controller('linkcontroller',function(link, $scope, $location){      $scope.go = function(link){  	$location.url(link);       };  });
<div class="btn-group btn-group-lg" data-ng-controller = "linkcontroller">      <button type="button" class="btn btn-primary" data-ng-click = "go('test1.html')">click1</button>      <button type="button" class="btn btn-primary" data-ng-click = "go('test2.html')">click2</button>  </div>  	


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -