小编Sah*_*han的帖子

如何在angularjs中使用多个索引页面

我想访问我的视图中的localhost:3000/admin .. index.html和admin.html是我的两个不同的基本文件,一个用于用户,另一个用于管理仪表板

在我的app.routes.js我有这个

 angular.module('appRoutes', ['ngRoute'])
.config(function($routeProvider, $locationProvider) {

$routeProvider

    .when('/', {
        templateUrl: 'app/views/pages/home.html',
        controller: 'MainController',
        controllerAs: 'main'
    })
    .when('/admin', {
        templateUrl: 'app/views/admin.html',
    })
    .when('/logout', {
        templateUrl: 'app/views/pages/home.html'
    })
    .when('/login', {
        templateUrl: 'app/views/pages/login.html'
    })
    .when('/signup', {
        templateUrl: 'app/views/pages/signup.html'
    })
    .when('/admin/login' ,{
        templateUrl: 'app/views/pages/adminlogin.html'
    })

    $locationProvider.html5Mode(true);
   })
Run Code Online (Sandbox Code Playgroud)

在server.js我有这个

app.get('*', function(req, res){
res.sendFile(__dirname + '/public/app/views/index.html');
});
Run Code Online (Sandbox Code Playgroud)

有两个html索引文件:index.html,admin.html我想打开admin.html时url是:localhost:3000/admin

和index.html当url是:localhost:3000时

应用程序结构的屏幕截图

在views/pages中我有index.html和admin.html使用ng-view所需的所有html页面

html javascript angularjs angular-routing

7
推荐指数
1
解决办法
4760
查看次数

从 aws ec2 实例中删除端口号 3000 的要求

我已经通过 aws ec2 (mean bitnami hvm) 实例托管了我的 MEAN 项目。它在端口 3000 上运行,我可以通过以下方式访问我的实例: ec2-xx-xx-xx-xx.amazonaws.com:3000

我想访问没有端口号(3000)的实例,即:ec2-xx-xx-xx-xx.amazonaws.com

我怎样才能做到这一点?

amazon-ec2 mean bitnami amazon-web-services

5
推荐指数
1
解决办法
2066
查看次数