Tag: ionic2

无法发布来自Ionic应用程序的HTTP请求

我正尝试login到本地托pipe的应用程序(现在)使用ionic framework。 这是我login的nodejs后端代码,这是为web应用程序的意思,但现在我也为android platfrom // process the login form app.post('/login', passport.authenticate('local-login', { successRedirect: '/profile', // redirect to the secure profile section failureRedirect: '/login', // redirect back to the signup page if there is an error failureFlash: true // allow flash messages })); HTML代码在离子 <ion-item> <ion-input type="text" placeholder="Email" name="email" [(ngModel)]="email"></ion-input> </ion-item> <ion-item> <ion-input type="password" placeholder="Password" name="password" […]

Angular2 http向其他端口上的nodejs服务器发送请求

我有一个在localhost:4200上运行的angular2应用程序,在localhost:3000上运行nodejs服务器。 我想用http.post将数据发布到服务器,但是在req.body或req.params的nodejs服务器中我得到了未定义的数据。 起初,我有从服务器呈现的angular2应用程序,这意味着我只有localhost:3000的nodejs,我根本没有任何问题,所以这不是sytax问题,但是当我想分开客户端和服务器,我不能'不发表任何要求。 GET请求的作品。 我有TodoService与服务器交互,并具有saveTodofunction。 newTodo是有效的,console.log提供了正确的信息。 我试过发布json和张贴与url-params和两个不工作:发布json: saveTodo(newTodo: any) { let headers = new Headers(); headers.append('Content-Type','application/json'); return this.http.post('/api/v1/todo', JSON.stringify(newTodo), {headers: headers}) .map(res => res.json()); } 发布url参数: saveTodo(newTodo: any) { let headers = new Headers(); headers.append('Content-Type','application/x-www-form-urlencoded'); let body = new URLSearchParams(); body.set('newTodo', newTodo); return this.http.post('/api/v1/todo', body, {headers: headers}) .map(res => res.json()); } 我从组件中调用这个函数: addTodo(event: any) { […]

cordova不是一个有效的任务

我格式化我的Mac并设置离子环境 1.install node.js 2.npm install -g cordova 3.npm install -g ionic@2.2.3 之后, ionic serve -l可以运行没有错误,但是当我尝试build立android ionic cordova build android –prod错误出来。 离子信息: Your system information: Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on. 7.0.1 Ionic Framework Version: 2.0.0 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 Ionic […]

用于cloudboost的打字稿(和ion2一起使用)

我想知道任何可用的typescloudboost.io https://github.com/CloudBoost/JavaScriptSDK 。 我没有为现有的js模块写types的经验。 我试图准备任何最愚蠢的d.ts但没有成功。 即使用ionic2和npm install cloudboost (目前也需要单独npm install fs )我正在尝试使用cloudboost.d.ts 。 declare module "cloudboost" {} 要么 declare var CB: any; declare module "cloudboost" { export var CB: any; } 结果是奇怪的,因为cloudboost包含到ionic2构build(使用它的webpackconfiguration),但是当使用ie import * as CB from "cloudboost"; 或类似的import变体,即使内部webpack调用似乎指向适当的cloudboost代码,也会返回一些socket.io对象的CB值。 所以即使any愚蠢的东西都会让我满意。

离子2无法find模块'dgram'

我已经安装了一个模板Ionic 2应用程序,并希望添加NPM包bonjour 在安装并在我的组件中包括这样的包: var Bonjour = require('bonjour'); var bonjour = new Bonjour(); 该应用程序不会运行说明'无法find模块dgram' 该应用程序已经安装了bonjour包和bonjourtypes。 问题 应用程序无法find位于@ types / node文件中的模块dgram。 该项目正在运行TS 2.4.2 ,不应该需要任何对@types的引用,这应该被自动拾取。 我试过了什么 我试着用多种方式试图包含@types文件夹,方法是在ts.config.json文件中设置typeroot或type。 这并没有改变任何东西。 我试过指定types: "types": ["node", "bonjour"] 我试着重新安装所有节点模块并清除caching 我试着在require语句上面的组件中包含一个引用path: /// <reference path="node_modules/@types/node/index.d.ts" /> var Bonjour = require('bonjour'); var bonjour = new Bonjour(); 这一切都没有帮助。 任何想法如何使我的应用程序正确加载此模块?

build立开发失败:无法设置为null的属性'fileSystem'

我正在尝试运行Ionic 2应用程序。 我正在执行运行ionic serve错误 build立开发失败:无法设置为null的属性'fileSystem' 完整的日志如下: λ ionic serve > ionic-hello-world@ ionic:serve D:\ionic > ionic-app-scripts serve [18:11:23] ionic-app-scripts 0.0.47 [18:11:24] watch started … [18:11:24] build dev started … [18:11:24] clean started … [18:11:24] clean finished in 6 ms [18:11:24] copy started … [18:11:24] transpile started … [18:11:28] transpile finished in 4.15 s [18:11:28] webpack started […]