我正在尝试使用Angular2运行ckeditor.我正在使用Angular CLI,我有一个非常基本的工作应用程序.
我已经intstalled 这个包使用npm install ng2-ckeditor.我system.config.js按照他们的例子完全设置了我的文件,即:
System.config({
"map": {
"ng2-ckeditor": "npm:ng2-ckeditor",
},
"packages": {
"ng2-ckeditor": {
"main": "lib/index.js",
"defaultExtension": "js",
},
}
});
Run Code Online (Sandbox Code Playgroud)
并app.modules.ts以同样的方式包含在我的中:
从'ng2-ckeditor'导入{CKEditorModule};
@NgModule({
// ...
imports: [
CKEditorModule
],
// ...
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
运行后ng build,ng serve我在控制台中收到以下错误:
模块'AppModule'导入的意外值'CKEditorModule'
我不明白为什么?
我有一个使用角度CLI构建的简单Web应用程序。我希望它使用Web套接字与后端通信。我已经编写了后端,并使用服务器可以在套接字上发送和接收的简单index.html页面进行了测试。
在我的angular-cli项目中,我设置了一个代理配置文件来设置到后端的代理。
proxy.conf.json
{
"/sock": {
"target": "http://localhost:3000",
"changeOrigin": true,
"ws": true,
"logLevel": "debug"
}
}
Run Code Online (Sandbox Code Playgroud)
然后使用以下命令启动服务器。
ng serve --proxy-config proxy.conf.json
Run Code Online (Sandbox Code Playgroud)
现在,我有一项服务,只是尝试打开一个套接字并发送一个固定的字符串,我希望该字符串被后端记录下来。
import { Injectable } from '@angular/core';
import * as io from 'socket.io-client';
@Injectable()
export class ChatService {
private socket: any;
constructor() {
this.socket = io({ 'path': '/sock' });
this.socket.emit('chat message', 'Hello World from browser!');
}
}
Run Code Online (Sandbox Code Playgroud)
注意:无论是否使用url的/ sock部分,我都可以这样做。
我启动两个服务器。在浏览器中没有任何控制台错误。但是在有角CLI Web包服务器中,我收到以下消息。
10% building modules 2/2 modules 0 active[HPM] Proxy created: /sock -> http://localhost:3000
[HPM] Subscribed to http-proxy events: [ …Run Code Online (Sandbox Code Playgroud) 如何在角度cli生成的项目中使用绝对路径?
所以我有这条道路:src -> app -> shared
我想写import {} from 'shared/ffdsdf/my.module.ts'
而不是'../shared/ffdsdf/my.module.ts'
angular-cli用于完美地工作,但现在我不知道为什么在创建新项目时它不运行服务器.
我尝试重新安装angular-cli.
我创建了一个新的应用程序ng new app.我导航到/ app/path,运行ng serve,我得到:
No errors
Error: No errors
at validate (C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\extract-text-webpack-plugin\schema\validator.js:10:9)
at Function.ExtractTextPlugin.extract (C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\extract-text-webpack-plugin\index.js:188:3)
at C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\angular-cli\models\webpack-build-styles.js:79:83
at Array.map (native)
at Object.getWebpackStylesConfig (C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\angular-cli\models\webpack-build-styles.js:76:43)
at new NgCliWebpackConfig (C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\angular-cli\models\webpack-config.js:44:51)
at Class.run (C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\angular-cli\tasks\serve-webpack.js:23:22)
at C:\Users\Gasti\Documents\Prgm\githubsearch\node_modules\angular-cli\commands\serve.run.js:37:22
at process._tickCallback (internal/process/next_tick.js:103:7)
Run Code Online (Sandbox Code Playgroud) 我在全球范围内安装了最新版本的angular-cli.版本如下.
C:\Users\W055013\kumar\learn\rx>ng --version
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.
To disable this warning use "ng set --global warnings.packageDeprecation=false".
_ _ _
__ _ _ __ __ _ _ _ | | __ _ _ __ ___ | |(_)
/ _` || '_ \ / _` || | | || | / _` || '__|_____ …Run Code Online (Sandbox Code Playgroud) 基于对我的另一个问题的评论(gradle如何将文件javascript fies添加到war文件中的目录)我正在尝试使用angular-cli来帮助构建和管理角度项目.但是,我似乎无法找到有关如何在项目中创建第二个网页的任何文档,这对我来说似乎是一项非常基本的任务.我试着创建一个"组件" ng g component {component name},但这并没有为构建结果添加任何内容.
嗨,由于angular-cli的版本,我正在部署我的应用程序.
我查了一下,我的angular-cli的版本是
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.1 <-- 1.0.1
@angular/compiler-cli: 2.4.10
Run Code Online (Sandbox Code Playgroud)
我真的需要将版本降级到1.0.0 beta-24版本.
我怎样才能做到这一点?
在我的由angular-cli生成的应用程序中,有angular-cli.json一个控制ng操作的文件。
但是,如何排除根目录中指定的src内的某些文件夹?
"apps": [{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}],
Run Code Online (Sandbox Code Playgroud)
我想添加类似的东西,"exclude": [ "folder_name1", "folder_name1" ]但我找不到在此达成共识的任何解决方案。
我正在将Angular 4项目的部署工具切换为angular/cli.该命令默认ng build将生成的包放在一个dist文件夹中.
我需要弄清楚如何将自定义任务添加到此过程.具体来说,我需要将大量.svg文件捆绑并缩小为sprite.defs.svg文件,并将结果放入dist/assets/svg/.使用我以前的部署工具链,我使用gulp了gulp-svg-sprite插件.这是我的捆绑步骤:
const svgSprite = require('gulp-svg-sprite');
gulp.src('**/*.svg')
.pipe(svgSprite({
mode: {
defs: {
dest:'.',
sprite:"sprite.defs.svg"
}
}
}))
.pipe(gulp.dest('dist/assets/svg'));
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法将这样的东西整合到angular/cli中ng build?
deployment bundling-and-minification gulp angular-cli angular
我已经开始学习Angular了,但是我注意到Windows中的powershell每当执行如下的angular命令时都会出现错误:
ng new new-app
Run Code Online (Sandbox Code Playgroud)
要么
ng serve
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
ng : File C:\Users\< username >\AppData\Roaming\npm\ng.ps1 cannot be loaded because
running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ng serve
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)
PS我尝试在cmd中的这些命令,它的工作原理。
angular-cli ×10
angular ×9
javascript ×3
ckeditor ×1
deployment ×1
gulp ×1
node.js ×1
npm ×1
powershell ×1
systemjs ×1
typescript ×1
webpack ×1
websocket ×1