Tag: 量angular器

获得ngPrime为Angular 2工作

我已经在Angular 2项目上工作了,到目前为止GMap和Chartjs的工作。 但现在我有问题,如果我包括一个Accordeon它没有得到格式正确。 我包括primeng和primeui通过 npm install primeng –save npm install primeui –save 还有font-awesome via npm安装字体真棒 – 保存 这是我的angular-cli.json "styles": [ "styles.css", "../node_modules/primeng/resources/themes/omega/theme.css", "../node_modules/font-awesome/css/font-awesome.min.css", "../node_modules/primeng/resources/primeng.min.css", "../node_modules/primeui/primeui-ng-all.min.css" ], "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/bootstrap/dist/js/bootstrap.js", "../node_modules/primeui/primeui-ng-all.min.js" ], 这是迄今为止的结果。 产生的输出 这将是很好,如果有人可以提出一些build议:-)

Angular 2路由器:不能匹配任何路由

当试图在我的浏览器中加载localhost:3000 / verifyemail时,我收到错误: 错误:无法匹配任何路线 我已阅读了其他SO问题,并已validation以下内容: Angular2:2.3.1默认使用path位置策略,我没有改变它。 我不喜欢使用哈希位置策略 我已经configuration了我的Nodejs服务器的HTML5 pushState(server.js在下面) // Parsers for POST data app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); // Point static path to dist app.use(express.static(path.join(__dirname, 'dist'))); // Get API routes const api = require('./src/server/routes/api.js'); // Set api routes app.use('/api', api); // Catch all other routes and return the index file app.get('*', (req, res) => […]

Angular-cli得到错误

我是Angular 2的新手,试图开始发展。 我已经安装了npm(3.10.10)和Anugular-cli(1.0.0-beta.28.3),节点(v6.9.5)。 我用新的开始创build新项目(开始是新项目的名称)。 现在我试图build立或启动服务器获取错误(与详细): PS E:\#Angular2\001_begin\begin> ng build –verbose fallbackLoader option has been deprecated – replace with "fallback" loader option has been deprecated – replace with "use" … … Hash: 548903fff1e2f098f7d9 Version: webpack 2.2.0 Time: 16219ms Asset Size Chunks Chunk Names polyfills.bundle.js 254 kB 0, 4 polyfills main.bundle.js 6.53 kB 1, 4 main styles.bundle.js […]

在Angular 2应用程序中使用本地npm仓库中的组件

我已经使用d3和Angular 2实现了一个通用的图表组件。然后将它发布到本地的npm仓库中,以便任何人只要运行npm install my-chart命令就可以在他们的Angular项目中使用这个图表组件。 我创build了一个基本的Angular 2项目来重用我的图表组件。 然后运行npm install my-chart –save ,向package.json添加“@ my / my-chart”:“^ 1.0.0” 。 但运行服务器时出现问题,它会在我的控制台上提示错误。 Module not found: Error: Can't resolve 'd3' in '…\node_modules\@my\my-chart' 我需要在我的Angular项目中安装D3吗? 但是我觉得在我们运行npm install my-chart的时候,把d3和图表组件捆绑在一起会更好。 什么是最好的? 已发布软件包的package.json文件: { "name": "@my/my-chart", "version": "1.0.2", "license": "MIT", "angular-cli": {}, "author": "rosew", "main": "./index.js", "keywords": [ "button", "card" ] } 消费包的package.json文件: "dependencies": { "@angular/common": […]

量angular器asynchronous等待不是一个function

你好,我试图使用asynchronous等待,但不知道如何做到这一点。 这是我的代码。 我有节点7.6.0安装。 量angular器v5.1.1和诺言pipe理器在我的conf.js中被禁用。 "use strict"; console.log('111'); describe('A', function(){ console.log('222'); it('B', async function(){ await browser.get('http://www.yahoo.com'); console.log('333'); }); }); 当我运行testing时,它说我的callback不是一个函数。 1) A encountered a declaration exception – Error: async function (){ browser.get('http://www.yahoo.com'); console.log('333'); } is not a function browser.get('http://www.yahoo.com'); console.log('333'); } is not a function 为什么? 我该如何解决? 不知道我是否正确写入。 谢谢。

MEAN Stack app – 发送后无法设置标题

我基本上是试图创build一个使用MEAN注册页面,我想检查数据库(Mongo使用Mongoose),如果用户和电子邮件已经存在,如果其中一个是真的,发送res.json失败。 如果用户名和电子邮件不在数据库中,请继续添加用户。 我收到一个错误“发送后无法设置标题”。 在节点控制台上,我试图找出原因。 一旦User.getUsername()在callback中返回一个用户(如果用户名传递存在于数据库中),不应该返回JSON并在那里结束请求? 为什么它继续到User.adduser()函数并尝试在那里设置标题呢? 任何帮助表示赞赏,谢谢。 router.post('/register', (req, res, next) =>{ let newUser = new User({ // Collect body info name: req.body.name, email: req.body.email, username: req.body.username, password: req.body.password }); // Check if username is available User.getUserByUsername(newUser.username, (err, user) => { if(err) throw err; if(user){ return res.json({success: false, msg: 'User already exists'}); // I want […]

如何访问茉莉花量angular器执行spec的文件名?

例如我开始我的testing protractor –specs spec1.js,spec2.js config.js 我希望为spec1-tests的每次运行输出一次“spec1.js”,在spec2-tests的每次运行中输出一次“spec2.js”。

当使用angular version 2.4.9,typescript&webpack version 2.2.1时,属性'map'在types'Observable <Response>'上不存在

我正在尝试从Angular 2应用程序访问web api方法,我能够使用web api获取logging。 但问题是,显示属性“地图”的 service.ts文件不存在types“可观察”错误。 示例代码: import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/Rx'; @Injectable() export class ContactServices { private url = 'http://localhost:51498/api/test/'; constructor(private http: Http) { } getContacts():Observable<Object[]> { return this.http.get(this.url + 'GetContacts') .map(response => response.json()) .catch(error => { console.log(error); return […]

量angular器如何使用npm属性读取器从属性文件调用具有多个套件值的键

我有一个要求,我需要在conf.js文件外存储一些数据。 所以我已经安装了属性阅读器节点模块,但我在访问某些关键值时遇到一些问题。 以下是我的属性文件和conf.js文件 config.properties文件 [main] browserName = chrome shardTestFiles = true maxInstances = 4 suites = ../specs/folder1/*.js conf.js文件 var PropertiesReader = require('properties-reader'); var properties = PropertiesReader('config.properties'); multiCapabilities: [ { 'browserName': properties.get('main.browserName'), shardTestFiles: properties.get('main.shardTestFiles'), maxInstances: properties.get('main.maxInstances'), }, suites: { Suite : [properties.get('main.suites')], }, 与上面的configuration我可以执行folder1中的所有规格。 但是当我尝试添加一个以上的文件夹。 config.properties文件 [main] browserName = chrome shardTestFiles = true maxInstances = 4 […]

如何* ngFor使用angular2中的模板variables?

主要成分: HTML <event-thumbnail *ngFor='let event1 of events' #thumbnail [event2]="event1" (eventClick)='handleEventClicked($event)'>Hello</event-thumbnail> <button class='btn btn-primary' (click)="thumbnail.alertFoo()">alert id</button> <button class='btn btn-primary' (click)='thumbnail.handleClickMe()'>click me!</button> 事件 – 缩略图提示 alertFoo(){ alert("id called"); } handleClickMe(){ this.eventClick.emit('foo'); alert('click'); } 在上面的代码中,当使用* ngFor时,我无法使用缩略图使用button – >模板variables。 没有调用alertFoo和handleClickMe()通过缩略图。 我也试图把它包装在div中,但仍然无法正常工作。 它只适用于当我把整个代码封闭在一个div中的时候,也就是说,也就是说,那些显示不需要的多个button的button。 我想了解ngFor的工作方式是否有一些解决上述问题,我希望事件重复,但button只能显示一次。