我想在sails應用程序中正確創建一個angular2應用程序。Angular2 in sails應用程序配置
我想AngularApp下/管理URL運行
我做了什麼:
- 創建ManagementController.js:
module.exports = {
index: function (req, res) {
res.locals.layout = 'layouts/angular';
return res.view('angular/angular-start.ejs');
}
};
- 根據views/layouts/angular.ejs創建角佈局:
創建下視圖/角度/角start.ejs
加載的圖...
創建的文件夾資產/管理在我的角度應用程序將是
創建資產/管理/ 應用文件夾
加入copy.js:
grunt.config.set( '複製',{ 開發:{ 文件:[{ 擴大:真實, CWD:」 ./assets', SRC :['/', '!/ .coffee', '! /.ts', '!/ .LESS' ], DEST:「.TMP /公衆 }]} , 編譯:{ 文件:[{ 擴大:真實, CWD: '的.tmp /公衆', SRC :[」 /'], DEST: 'WWW' }] }, angular_node_deps:{ 文件:[{ 擴大:真, CWD:, SRC'。 ':[ ' ./ node_modules/es6-shim/es6-shim.min.js', './node_modules/systemjs/dist/system-polyfills.js', './node_modules/systemjs/dist/system.src.js', './node_modules/zone.js/dist/zone.js' , './node_modules/reflect-metadata/Reflect.js', ' ./node_modules/rxjs//的.js', 」 ./node_modules/@angular/core/bundles/core.umd.js' , './node_modules/@angular/compiler/bundles/compiler.umd.js', './node_modules/@angular/common/bundles/common.umd.js', './node_modules/@angular/ platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', './node_modules/@angular/platform-browser/bundles/platform-browser.umd。js' ], dest:'.tmp/public/js' }] } });
<!DOCTYPE html>
<html>
<head>
<title>Reloyalty Administration Dashboard</title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="/favicon.ico">
<!-- Common Scripts-->
<script src="/common/js/jquery-1.11.3.min.js"></script>
<!--SCRIPTS-->
<!--SCRIPTS END-->
<script>
// SystemJS
// config goes here
</script>
<!-- end AngularJS 2-->
</head>
<body>
<%- body %>
</body>
</html>
什麼我現在做的有它運行正常......我一直在嘗試所有的日子,所以我不想現在就張貼我的代碼,使這項工作,但只要按照您的指示,因爲我有在我的代碼中做了很多更改,我不理解它。