如何在angularjs中有条件地加载不同的index.html

如何在angularjs中有条件地加载不同的index.html,angularjs,Angularjs,我正在构建angular应用程序,并使用标准index.html文件: 发送到另一个html的逻辑应该放在您的登录模块中。它可能与Angularjs无关有一些代码可以从angular应用程序的外部或内部重定向另一个页面 $location.url('/RouteTo/index'); $location.url('/index'); $window.location.href="http://www.domain.com/home"; window.location = "http:/

我正在构建angular应用程序,并使用标准index.html文件:



发送到另一个html的逻辑应该放在您的登录模块中。它可能与Angularjs无关

有一些代码可以从angular应用程序的外部或内部重定向另一个页面

$location.url('/RouteTo/index');

$location.url('/index');

$window.location.href="http://www.domain.com/home";

window.location = "http://www.domain.com/home";

您可以获取应用程序的主机
$window.location.host

使用类似于此窗口的javascript位置。location='您的页面url';您可以使用ng include,不同的html文件取决于您的状态(登录或不登录),例如:
ng if=logged ng include=“logged template”
您的问题有点宽泛。这个“索引”除了脚本之外没有任何唯一的元素,所以实际上没有必要替换这个文件。如果您希望angular控制“home”内容,那么它应该是angular中的路由,
home.html
应该是加载到
ng视图中的模板。如果您不希望angular控制内容,那么它应该是服务器上的一条路由,angular根本不知道。@Claises这是正确的。我希望有一个与Angular无关的“home.html”文件(带有自己的css/js)。它只是一个静态文件。如果用户访问“/”,我将如何提供服务?