我有路由
app.config(function ($routeProvider) {
$routeProvider.
when("/questions", {controller:"Questions", templateUrl: "questions.html"}).
when("/objections", {controller: "Objections", templateUrl: "objections.html"}).
when("/objections/:oId", {controller: "Objections", templateUrl: "objections.html"}).
when("/persons", {controller: "Persons", templateUrl: "persons.html"}).
when("/persons/:pId", {controller: "Persons", templateUrl: "persons.html"}).
when("/questions/:qId", {controller: "Questions", templateUrl: "questions.html"}).
otherwise({redirectTo : "/persons"});
})
和 /objections 和 /objections/:pId 的一个模板
<script type="text/ng-template" id="objections.html">
<div class="stroke">
<label>Поиск: <input class="border" type="text" ng-model="search.text"></label>
<ul class="objections-objections left_column">
<li class="border" ng-repeat="objection in objections | filter:search">
<a href="#/objections/{{objection.id}}">
{{objection.text}}
</a>
</li>
</ul>
<div class="right_column">
<p class="header"></p>
<p class="text">
<span>ID возражения: {{objection.id}}</span>
<br>
<textarea class="border" name="" id="" cols="30" rows="10" ng-model="objection.text"></textarea>
</p>
<ul class="questions-objections" ng-show="objection.questions.length">
<span>Список вопросов</span>
<li class="border" ng-repeat="question in objection.questions">
<a href="#/questions/{{question.id}}">{{question.text}}</a>
</li>
</ul>
<p class="footer">
<button ng-click="add()">Добавить</button>
<a href="" ng-click="delete(objection)">Удалить</a>
<a href="" class="save" ng-click="save()">Сохранить</a>
<a href="" class="close" ng-click="cancel()">Закрыть</a>
</p>
</div>
因此,当我在搜索字段中输入文本并对列表项进行排序时,然后我单击其中一项并查看搜索字段
我应该如何要求我的代码在此路由之间不会重置 search.text 指令?
谢谢你