2016-09-05 4 views
2

私はAngularJsバージョン1.5を使用しています。私は、その後のコメントAngulajsのPopoverテンプレートの変数にアクセスできませんコンポーネント

angular.module('myapp') 
.component('comments', { 
    templateUrl: "views/component/comments.html", 
    bindings: { }, 
    controller: function ($http, $rootScope, $interval, $scope) { 
     var ctrl = this 
     ctrl.users = $rootScope.users; 
     console.log(ctrl.users); // This variable had value 
    } 
}) 

を追加するために、簡単なコンポーネントを作成したビューでは、私はポップオーバーに

<button popover-is-open="$ctrl.userListPopoverStatus" popover-title="Add User" uib-popover-template="'views/popover/order_select_user.html'" popover-placement="top" class="btn btn-primary" ng-model="$ctrl.users"><i class="fa fa-fw fa-tags"></i></button> 

を表示するためにボタンを配置私のポップオーバーテンプレート

<div class="row margintop-10"> 
<form class="form-horizontal"> 
    <table class="table table-striped small_table_user"> 
     <tr> 
      <td> 
       <input type="text" class="form-control" ng-model="$ctrl.searchText" placeholder="Search user" /> 
      </td> 
     </tr> 
     <tr ng-repeat="user in $ctrl.users | filter:$ctrl.searchText"> 
      <td ng-click="pickUserProcess(user.id)">{{user.name}}</td> 
     </tr> 
    </table> 
</form> 

しかし、Bootstrap Popoverは$ ctrl.users変数にアクセスできないため、リストのユーザーはまったく表示されません。これをどうすれば解決できますか?

答えて

0

これは、角のドットの問題の原因になると思います。 試してみてください。

var ctrl = {} 
ctrl.users = $rootScope.users; 
+0

それはまだ –

+0

'Ctrlキーを動作しない== $ ctrl'! – svarog

関連する問題