平均堆栈 - angular 2 网站未完全加载
Mean stack - angular 2 Site not loading completely
我目前正在使用 MEAN 堆栈 angular 2.
我不知道问题出在哪里。
我正在获取未完全加载的网站。不确定它是否 CSS 问题。
这里是文件夹结构,其中 端口 为 Angular 2 个应用程序配置。
但是当我尝试访问页面时:http://my_ip:9200/admin/login 我没有完全加载 css。即)页面未完全加载。
/var/www/html/Express/Local-MEAN-dev/index.js
...
const port = process.env.PORT || 9000;
....
//Start Server: Listen on port 9000
app.listen(port, () => {
console.log('Listening on port ' + port);
});
package.json
{
"name": "mean-ang2",
"version": "1.0.0",
"description": "MEAN Stack with Angular 2",
"main": "index.js",
"scripts": {
"start": "node index.js",
"build": "cd client && ng build --prod"
},
"repository": {
"type": "git",
"url": ""
},
"keywords": [
..
],
"author": "",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
...
},
"devDependencies": {
"@angular/cli": "^1.2.3"
}
}
下/var/www/html/Express/Local-MEAN-dev/admin
这是我的 angular 2 代码。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Food4Smiles</title>
<base href="/admin">
<!--<link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.css">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/static/hmicon.png">
</head>
<body>
<app-root></app-root>
<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
要为管理员配置自定义端口,我编辑了以下文件:
\Local-MEAN-dev\admin\node_modules\@angular\cli\commands\serve.js
const defaultPort = process.env.PORT ||9200;
在head标签中添加bootstrapcsslink。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
我目前正在使用 MEAN 堆栈 angular 2.
我不知道问题出在哪里。
我正在获取未完全加载的网站。不确定它是否 CSS 问题。
这里是文件夹结构,其中 端口 为 Angular 2 个应用程序配置。
但是当我尝试访问页面时:http://my_ip:9200/admin/login 我没有完全加载 css。即)页面未完全加载。
/var/www/html/Express/Local-MEAN-dev/index.js
...
const port = process.env.PORT || 9000;
....
//Start Server: Listen on port 9000
app.listen(port, () => {
console.log('Listening on port ' + port);
});
package.json
{
"name": "mean-ang2",
"version": "1.0.0",
"description": "MEAN Stack with Angular 2",
"main": "index.js",
"scripts": {
"start": "node index.js",
"build": "cd client && ng build --prod"
},
"repository": {
"type": "git",
"url": ""
},
"keywords": [
..
],
"author": "",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
...
},
"devDependencies": {
"@angular/cli": "^1.2.3"
}
}
下/var/www/html/Express/Local-MEAN-dev/admin
这是我的 angular 2 代码。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Food4Smiles</title>
<base href="/admin">
<!--<link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.css">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/static/hmicon.png">
</head>
<body>
<app-root></app-root>
<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
要为管理员配置自定义端口,我编辑了以下文件:
\Local-MEAN-dev\admin\node_modules\@angular\cli\commands\serve.js
const defaultPort = process.env.PORT ||9200;
在head标签中添加bootstrapcsslink。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">