ビューの関数パラメータを介して値をコントローラに渡しています。次に、私はその値を$ scopeに保存しています。それから私は範囲を介して別のHTMLページに同じ値にアクセスしようとしています。しかし値は利用できません。私はルーティングのためにUIルータを使用しています。誰もがこれの原因となるかもしれないことを教えてもらえますか?ビューからコントローラanglejsへのデータの受け渡し
obj.roleIdがopenwindow1関数でコントローラに渡される最初のページです。
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<table class="table">
<thead align="center" class="thead-inverse">
<tr>
<th>
Role Name
<div class="getSortClass('roleName')"></div>
</th>
<th>
Role ID
<div class="getSortClass('roleID')"></div>
</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr align="center">
<td>{{obj.roleName}}</td>
<td>{{obj.roleID}}</td>
<td><button class="btn btn-primary">Edit
User</button><button class=
"btn btn-primary">Delete</button></td>
</tr>
</tbody>
</table>
</body>
</html>
これはコントローラです。私は$ scope.roleIdkに値を格納しています:
.controller('UserRoleEdit', ['$compile', '$scope', '$window',
function($compile, $scope, $window) {
$scope.openWindow1 = function(roleID) {
$window.open(
'http://localhost:9000/#/homepage/userRoleEdit',
'User Role
Edit',
'width=1300,height=1000');
$scope.roleIDk = roleID;
alert($scope.roleIDk);
};
}
]); {{}} roleIDk
しかし、私はそれにアクセスすることはできません。
最後に、私は別のHTMLビューにアクセスしようとしています。
私たちがあなたのコードを見ることができないなら、助けが大変です:) –
私はコードを追加しました。それを見てください。 – darkknight