我有index.html作爲主頁面和indexController.js。 index.html的具有部分體通過jQuery調用控制器的AngularJS函數來更新主控制器
<div ng-view=""></div>
加載局部視圖,例如,login.html的
純AngularJS項目使用語義UI。 login.html具有表單登錄並實現了語義UI的FormValidation。
$(document).ready(function() {
$('.ui.form')
.form({
// some setting....
onSuccess: function (event, fields) {
var scope = angular.element($('#loginForm')).scope();
scope.$apply(function() {
scope.login();
});
return false;
}
})
});
index.html中,我有邏輯隱藏或者顯示菜單
<a class="ui item" ng-hide="!authentication.isAuth" href="#/assets">Asset</a>
和indexController.js
$scope.authentication = authService.authentication;
如何更新它indexController的信息顯示或隱藏菜單?
你必須在控制器中定義你的表單功能。所以你可以更新範圍。 – hurricane
嗨@hurricane,我不明白你的意思嗎? –