Angularjs 将$scope变量传递到$state.href?

Angularjs 将$scope变量传递到$state.href?,angularjs,parameters,scope,href,state,Angularjs,Parameters,Scope,Href,State,下面是我的控制器中的一个函数 $scope.getUrl = function() { $state.href('newState', {randomId: $scope.randomId, anotherOne: $scope.anotherOne} ); }; 在模板中调用上述函数的方式如下(但当然不起作用): 是否有方法将$scope变量从我的控制器传递到$state.href 感谢您的任何反馈从getUrl() <div ng-href="{{getUr

下面是我的控制器中的一个函数

$scope.getUrl = function() {
   $state.href('newState', 
    {randomId: $scope.randomId, anotherOne: $scope.anotherOne}
   );
};
在模板中调用上述函数的方式如下(但当然不起作用):


是否有方法将$scope变量从我的控制器传递到$state.href


感谢您的任何反馈

getUrl()

<div ng-href="{{getUrl()}}">
$scope.getUrl = function() {
   return $state.href('newState', 
      {randomId: $scope.randomId, anotherOne: $scope.anotherOne}
   );
};