2016-08-08 3 views
-1

私は角度jを初めて使用しています。私はuser.htmlにデータベースの値を取得する必要があります。このページ(user.html)でdetails.htmlを呼び出す必要があるので、ng-includeタグを使用してdetails.htmlを呼び出しています。私はdetails.htmlにいくつかの値を渡す必要がありますが、この値は動的になります。この動的な値はdetails.htmlを渡す必要があります。ng-includeタグに値を渡す

例:

RouteManager.js: 

.when('/mydetails', 
{ 
    templateUrl : "./client/assets/views/user.html", 
    controller : "MyDetailsController" 
}) 

user.html: 

<div ng-include="'client/assets/views/details.html'" {{here i need to pass two parameters }}></div> 

details.html: 

<h1>{{need to display that two parameters}}</h1> 

注:details.htmlためのコントローラがありません。コントローラなしでやる必要があります。

答えて

0

あなたはonloadイベントを使用することができます。

<div ng-include="'myComponent.html'" 
    ng-controller="myComponentController" 
    onload="myItem = myItemValue"> 
</div> 

これは、ドキュメントの推奨される方法です。

関連する問題