我试图看看这些东西如何与州和州政府合作。穿过一个plunker(http://plnkr.co/edit/bsq7P9nDL46c3FwXsmBN?p=preview)并开始修改它。在下面的代码中 - $ state.href(myStateName,myParams)}似乎不起作用。任何人都可以解释
<!DOCTYPE html>
<html ng-app="MyApp" ng-strict-di>
<head>
<title>my app</title>
<style>ul { padding-left: 0; } li { list-style: none; }</style>
<script data-require="angular.js@*"
src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.js"></script>
<script data-require="ui-router@*"
src="//rawgit.com/angular-ui/ui-router/0.2.13/release/angular-ui-router.js"></script>
<script>
document.write('<base href="'+ document.location.pathname +'" />')
</script>
<script src="script.js"></script>
</head>
<body>
<ul>
<li><a href="#/home">home</a>
<li><a ui-sref="parent">parent</a>
<li><a ui-sref="parent.child">child</a>
</ul>
<div ng-controller="myCtrl">
<input ng-model="myStateName" /><br />
<input ng-model="myParams.param" /><br />
<a ng-href="{{$state.href(myStateName, myParams)}}"
>{{$state.href(myStateName, myParams)}}</a>
</div>
<div ui-view=""></div>
<script type="text/ng-template" id="tpl.html">
<div ui-view>
<h3>current state name: <var>{{$state.current.name}}</var></h3>
<h5>params</h5>
<pre>{{$stateParams | json}}</pre>
<h5>state</h5>
<pre>{{$state.current | json}}</pre>
</div>
</script>
</body>
</html>
&#13;