首页 > 解决方案 > 如何限制用户直接从 AngularJS (1.x) 中的 URL 访问 html 模板

问题描述

努力让用户限制直接在AngularJS(1.x)中访问HTML页面

我的应用程序 URL 是:https://mylocalhost/

该页面需要限制访问 URL:https://mylocalhost/common/security/login.html

尝试在 app.js 中使用“stateChangeStart”

$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams){
        //restric condition here
});

由于此 html 页面直接从 url 加载,因此此页面不受 appModule/loginController 控制。浏览器网络面板只显示加载的 Html 页面。

任何限制此页面直接访问的建议/建议。

标签: javascriptangularjs

解决方案


推荐阅读