【发布时间】:2014-12-23 18:52:35
【问题描述】:
您好,感谢您查看我的问题。我是 angularjs 新手,因此给我尽可能多的指导。
我有 2 页。 (1) - singlepage.php (这个真的是其他所有页面的主要容器 (2) - login.html(这个实际上是一个包含用户名、密码等文本框的片段
<!-- fragment from singlepage.php -->
<body ng-controller="AppController" class="{{bodyClass}}">
<div id="view" ng-view></div>
</body>
$routeProvider.when('/login', {
templateUrl: 'templates/login.html',
bodyclass: 'login',
controller: 'LoginController'
});
app.controller("LoginController", function($scope, $location, AuthenticationService, $route) {
$scope.bodyclass = 'login';
$scope.credentials = { email: "", password: "" };
$scope.login = function() {
AuthenticationService.login($scope.credentials).success(function() {
$location.path('/home');
});
};
});
我需要在登录页面加载时将 body 元素上的类更改为“loginbox”。
再次感谢
【问题讨论】:
标签: angularjs angularjs-directive