0
4

2 回答 2

1

尝试$location.path()

html:

<button data-ng-click="postCall()">Post</button>

在控制器中注入$location依赖项:

app.controller('myCtrl', function ($scope, $location) {  
    $scope.postCall = function() {
       $location.path("#post/" + $scope.name)
    };
});

文档

于 2016-06-05T14:45:13.720 回答
0

也许你需要这样的东西?

{{ name }}
<br>
{{ comment }}

在控制器中:

$scope.onClick = function () {
  $scope.name = 'this is name';
  $scope.comment = 'this is comment';
}
于 2016-06-05T14:49:25.260 回答