Tag: 量angular器

离子应用程序没有find提供者在链接包

我有一个离子应用程序和angular度的Web应用程序,都消耗相同的REST API。 对于初始开发,我已经在这两个项目中复制了api实现代码,但现在我想将api服务提取到链接的npm包中,这两个项目都可以作为模块使用和导入。 该软件包编译好,但我的离子应用程序无法find包中的服务模块的提供者。 我的服务包模块看起来像这样: import { NgModule } from '@angular/core'; import { ApiService } from './api.service'; import { AuthenticationService } from "./authentication.service"; import { CognitoUtil, CognitoCallback, LoggedInCallback } from "./cognito.service"; import { DocumentsService } from "./documents.service"; import { TagService } from "./tag.service"; import { UsersService } from "./users.service"; import { AwsUtil } from "./aws.service"; […]

当使用方法:POST时,AngularJS $资源调用错误的API URL

放入标题不是最简单的问题。 无论如何,我的应用程序是build立在nodejs / expressjs并且为这个url设置了一个API: 编辑:我正在使用的当前代码是: $scope.updateProduct = $resource('/api/updateProduct/:product/:param/:value',{},{ query: {method:'GET'}, post: {method:'POST'}, save: {method:'PUT', params: {brand: '@brand', param:'@param', value:'@value'}}, remove: {method:'DELETE'} }); $scope.updateProduct.save({ product : $scope.post._id, param: 'likes', value: $scope.user._id }); 目前它调用/api/updateProduct而不是/api/updateProduct/<product>/<param>/<value>就像我执行$scope.updateProduct.get()时的$scope.updateProduct.get() 。 在我的控制台中,我看到(作为一个例子): PUT /api/updateBrand/Quay%20Eyewear%20Australia/userTags/sunglasses,%20classic 200 30ms – 2.31kb 但是,API实际上没有被访问/没有任何反应。 有趣的是,如果我在我的浏览器中访问localhost:5000/api/updateBrand/Quay%20Eyewear%20Australia/userTags/sunglasses,%20classic ,它会发布正确的数据并更新我的数据库中的产品,所以肯定是$resource被调用的方式。

Express 4 + Angular 2 HTML 5路由问题

我正在使用Express 4和Angular 2制作一个基本的Web应用程序。在这里,除了使用HTML 5路由器之外,没有什么特别的Angular 2。 这是应用程序的路由工作stream程: 有两个主要的服务器端路由configuration的应用程序。 两者看起来类似这样: /* GET home page. */ router.get('/', authenticationHelpers.isAuth, function(req, res, next) { res.render('index'); }); /* GET login page. */ router.get('/login', authenticationHelpers.isNotAuth, function(req, res, next) { res.render('login'); }); 这些pipe理显式地pipe理用户路由到/和/login的两种情况。 但是,如果用户login并能够访问/呈现索引快速视图,则可以使用HTML5路由。 这些包括如下的url: localhost:5000/user localhost:5000/profile localhost:5000/profile/settings 问题 显然,没有router.get('/user') ,不应该有,因为这是Angular 2路由器完成的所有前端工作。 但是,要启用允许用户简单键入localhost:5000/profile/settings ,并让站点将您路由到索引文件(假设您已经login),然后路由您(使用angular2的HTML 5路由)到你自己的/profile/settings我必须把这段代码放在我的app.js : app.all("/*", function(req, res, next) { res.render('index'); }); […]

使用Typescript设置一个带有Angular 2前端的Node.js js服务器

我想在IBM Bluemix上托pipe我的Web应用程序,并希望使用TypeScript作为前端,并使用Node.js作为后端。 我如何设置服务器并将其连接到前端,主要是,我使用哪个编译器来编译ts文件?

出现错误'在angular2应用程序中运行服务时,无法读取未定义的属性'长度'

而使用angular-cli命令运行angular2应用程序ng-serve我收到以下问题 dashboard@0.0.0启动C:\ Users \ padmavathi \ Downloads \ phototype-development \ web \ dashboard ng serve Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8980:109) at parseSourceFileWorker (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8940:26) at Object.parseSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8899:26) at Object.createSourceFile (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\typescript\lib\typescript.js:8727:29) at new TypeScriptFileRefactor (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\refactor.js:25:35) at Object.resolveEntryModuleFromMain (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\entry_resolver.js:108:18) at AotPlugin._setupOptions (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:129:58) at new AotPlugin (C:\Users\padmavathi\Downloads\phototype-development\web\dashboard\node_modules\@ngtools\webpack\src\plugin.js:37:14) at […]

如何在for循环中处理量angular器promise?

我正在尝试做一些量angular器testing,并没有在for循环中解决承诺。 在我的testing案例中,我想在ng-repeat元素中find一个特定的节点。 这里是find这样一个节点的代码: var firstProfileNode = function(nodename, profile){ element.all(by.repeater('node in tree_nodes')).then(function(treeNodes){ for(var i=0; i<treeNodes.length; i++){ var node = treeNodes[i].element(by.css('.tree-dnd-handle')); node.getText().then(function(text){ console.log(i+" : "+text); if (profile){ var pattern = '^' +nodename+' \\(\\d+ devices\\)$'; var regx = new RegExp(pattern); if(regx.test(text)){ console.log('found') return node; } }else{ if(text === nodename){ return node; } } }); } }); }; var […]

尝试运行Angular Universal时错误“Unexpected token import”

我正在尝试生成一个Angular Universal,但是我遇到了一个问题“ts-node server.ts”。 输出logging如下: $ npm run start > prestart public-site > ng build –prod && ngc 12% building modules 24/32 modules 8 active …lic-site/src/styles.scssNode#moveTo was deprecated. Use Container#append. Hash: Time: 76999ms chunk {0} 0.chunk.js 11.9 kB {1} {2} {3} {4} {5} {6} chunk {14} inline.bundle.js (inline) 0 bytes > start public-site > ts-node src/server.ts […]

为什么会用`execvp`全新安装node.js和量angular器错误没有这样的文件或目录?

我已经安装了几个版本的node.js和量angular器,然后按照说明来更新webdriver,但没有一个组合我成功地启动了webdriver。 一些有用的细节: 在Ubuntu 64位 试了node.js v0.10.15和v0.10.26 测量量angular器0.18.1和0.19.0 以下是我运行的命令,以及相应的错误(安装量angular器后): $ webdriver-manager update Updating selenium standalone downloading https://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar… Updating chromedriver downloading https://chromedriver.storage.googleapis.com/2.8/chromedriver_linux64.zip… chromedriver_2.8.zip downloaded to /home/<user>/.nvm/v0.10.26/lib/node_modules/protractor/selenium/chromedriver_2.8.zip selenium-server-standalone-2.39.0.jar downloaded to /home/<user>/.nvm/v0.10.26/lib/node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar $ webdriver-manager start execvp(): No such file or directory seleniumProcess.pid: 4567 events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:988:11) at Process.ChildProcess._handle.onexit […]

Angular2 http.post和undefined req.body

从http.post接收json有问题。 让我们清楚一点:这是我的组件文件: import {Component} from 'angular2/core' import {Http, HTTP_PROVIDERS, Headers} from 'angular2/http' @Component({ selector: 'login-form', template: ` <form (ngSubmit)="onSubmit()"> <button type="submit">Wyslij</button> </form> ` }) export class LoginFormComponent { constructor(public http: Http) { } onSubmit() { var headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); var data = JSON.stringify({ login: "zupa", }); this.http.post('http://localhost:8080/send', data, {headers: headers}) .subscribe(); } […]

angular2testing应用卡在加载

为Angular 2制作一个testing应用程序,但由于某些原因,我无法解决,我的应用程序被卡在“正在加载…” 这里是文件: app.component.ts: import {Component} from '@angular/core'; import {LittleTourComponent} from './little-tour.component'; @Component({ selector: 'my-app', template: ` <h1>Test</h1> <little-tour></little-tour> `, directives: [LittleTourComponent] }) export class AppComponent { } 小tour.component.ts: import {Component} from '@angular/core'; @Component ({ selector: 'little-tour', template: ` <input #newHero (keyup.enter)='addHero(newHero.value)' (blur)="addHero.(newHero.value); newHero.value = '' "> <button (click) = addHero(newHero.value)>Add</button> <ul><li *ngFor='let hero of […]