0

すべてのタブが外部ファイルから独自のテンプレートをロードする 3 つのタブを持つアプリがあります。最初のタブの ng-model が 3 番目のタブに送信されない問題。

最初のファイル:

<div class="row">
  <div class="span2 text-right">*Reported By:</div>
  <div class="span2"><input type="text" ng-model="date" required></div>
  <div class="span2 text-right">*Well Number:</div>
  <div class="span2">
    <select ng-model="well" required ng-change="wellFunc(well)" required>
      <option ng-selected>Well-01</option>
      <option>Well-02</option>
      <option>Well-03</option>
    </select>
  </div>
</div>

2番:

<table class="table table-hover table-striped">
  <tr>
    <th><strong>General Information:</strong></th>
  </tr>
  <tr>
    <td  ng-model="date"></td>
  </tr>
</table>

また、私は ui-router を使用していますが、ルーターの問題でしょうか?

var myApp = angular.module('myApp', ["ui.router"])
myApp.config(function($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise("/re");
$stateProvider
.state('re', {
  url: "/re",
  templateUrl: "template/general.html"
})
.state('ro', {
  url: "/ro",
  templateUrl: "template/corrective.html"
})
.state('ri', {
  url: "/ri",
  templateUrl: "template/result.html"
})

});

4

1 に答える 1

0

確認するにはあなたのコントローラーを見る必要がありますが、あなたはおそらくあなたの日付を壊しています. あなたのコントローラーには、次のようなものがあると想定しています

$scope.date = "03/11/2014";

代わりに、このようなことをしてください

$scope.foo = { "date":"03/11/2014"}

htmlを次のように更新します

<input type="text" ng-model="foo.date" required>

ユーザーが入力を更新すると、他の「日付」参照は上書きされず、代わりに foo 参照の日付プロパティが更新されます。説明については、この簡単なビデオをご覧ください。 https://egghead.io/lessons/angularjs-the-dot

于 2014-03-12T02:43:21.993 に答える