2017-07-14 43 views
0

下面是我的一个功能

$scope.getUrl = function() { 
    $state.href('newState', 
    {randomId: $scope.randomId, anotherOne: $scope.anotherOne} 
    ); 
}; 

上述函数被调用模板中像这样(但不工作,当然):

<div ng-href="{{getUrl()}}"> 

有没有办法通过$范围变量从我的控制器到$ state.href?

任何反馈表示赞赏

回答

0

getUrl()

$scope.getUrl = function() { 
    return $state.href('newState', 
     {randomId: $scope.randomId, anotherOne: $scope.anotherOne} 
    ); 
}; 
返回你的价值