Tag: 量angular器

Webpack Angular 4开始的问题

我在我的Angular 4项目中遇到依赖问题。 这是package.json文件: { "name": "angular-webpack-starter", "version": "1.0.0", "description": "A webpack starter for Angular", "scripts": { "start": "webpack-dev-server –hot –inline –progress –port 8080 –open", "test": "karma start", "build": "rimraf dist && webpack –config config/webpack.prod.js –progress –profile –bail" }, "dependencies": { "@angular/animations": "^4.2.5", "@angular/common": "^4.2.5", "@angular/compiler": "^4.2.5", "@angular/compiler-cli": "^4.2.5", "@angular/core": "^4.2.5", "@angular/forms": "^4.2.5", "@angular/http": "^4.2.5", "@angular/platform-browser": […]

在Angular 2 + Electron中使用绝对path

我开始搞Angular 2和Electron,并使用这个入门包 。 一切似乎都进展顺利,我甚至可以使用节点fs包从目录中读取。 我遇到的问题是,我似乎无法使用readdirSync()方法的绝对path。 它只需要一个相对path。 我在文档fs中find了这个,你可以使用URL包来显示readdirSync()的绝对path,如下所示: const fs = require('fs'); const { URL } = require('url'); // file:///C:/tmp/hello => C:\tmp\hello fs.readFileSync(new URL('file:///C:/tmp/hello')); 这看起来不错,但在我的Angular 2 / TypeScript / Electron世界看来并不奏效。 我看起来像这样: import { Injectable } from "@angular/core"; import {readdirSync} from "fs"; import { URL } from "url"; @Injectable() export class LinkDocRetrieverService { getFiles():Array<String> { // read […]

MongoDb,NodeJs,Express和Angular 2,来自两个集合的数据join,复制和显示

我有两个mongo集合: 位置:(locationId,locationCity,locationState,locationZip等) carLocations:{carId,carType,carMake,locationId} 我想检索数据 carAvailability: {locationCity, locationState, locationZip, carMake, carType} 在我的nodejs层,这是我想要做的: 首先,我试图通过locationCity,locationState或locationZip检索locationIds数组。 一旦我有了一系列的locationIds,我正试图找回carLocations。 app.get("/api/carsbylocationids", function (req, res) { //console.log(" locationid:" + req.query.locationid); var locationIds = JSON.parse(req.query.locationIds); console.log("locationIds: " + locationIds); console.log("carId: " + req.query.carId); db.collection(carsLocations).find( { 'locationId': {$in:locationIds}, 'carId': req.query.carId } ).toArray(function (err, docs) { if (err) { handleError(res, err.message, "Failed to get items."); } […]

不能添加材料deviseangular度的项目

我尝试添加材料devise到我的项目,但是当我运行npm start我得到错误。 我尝试按照“入门” https://material.angular.io/guide/getting-started进行操作 我做了所有的步骤,这是行不通的。 你知道一些关于angular度+材料devise的教程吗? node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(31,22): error TS2420: Class 'MdButtonToggleGroup' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type 'MdButtonToggleGroup'. node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(31,50): error TS2507: Type '(new (…args: any[]) => CanDisable) & typeof MdButtonToggleGroupBase' is not a constructor function type. node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(90,22): error TS2420: Class 'MdButtonToggleGroupMultiple' incorrectly implements interface 'CanDisable'. Property 'disabled' is missing in type […]

Angular2 POST Observable Request返回一个不可读的JSON对象

我使用一个Angular2的POST请求与Observable到Node API。 我不断收到一个奇怪的JSON对象作为响应。 来自Node API应用程序的响应 – 通过Chrome控制台: {"_isScalar":false,"source":{"_isScalar":false,"source": {"_isScalar":false,"source":{"_isScalar":false},"operator": {"delay":500,"scheduler":{"actions":[],"active":false}}},"operator": {}},"operator":{"caught":"[Circular]"}} Angular2代码: login2(): Observable<any> { this.url = 'http://localhost:3080/user/login'; this.obj.email = 'jhon.doe@foo.de'; this.obj.password = 'pass'; let formObj = this.form.getRawValue(); let serializedForm = JSON.stringify(formObj); let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }); var obsRequest = this.http.post(this.url, this.obj, options) .map(res […]

在app.module上导入模式表单

我正在尝试在angular项目上使用angular度模式表单 ,但我无法将其导入到我的app.module.ts中。 这是我的configuration: app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { schemaForm } from 'angular-schema-form'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, schemaForm ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } […]

Angular2 http.post不能正常工作

服务: postJson() { var json = JSON.stringify({ "key": "CT", "values": ["FSP", "HMC", "PHYP","hell"] }); let headers = new Headers({'Content-Type':'application/json'}); //let options = new RequestOptions({headers: headers}); //headers.append('Access-Control-Allow-Origin', '*'); return this._http.post('http://localhost:8080/add',json,headers) .map(res => res.json()); } 零件: postData; onTestPost() { this._httpService.postJson() .subscribe( data=> this.postData = JSON.stringify(data), error=> alert(error), () => console.log("finished") ) } Node.js脚本 var express = require('express'); […]

使用nodejs和cointicker将数据保存到json

我正在学习nodejs,我正在创build一个服务器来使用名为Coin-Ticker的npm来获得encryption货币的价格。 我想在Angular应用程序中使用我得到的数据,但它不会在html中显示数据。 这是我的代码: server.js const express = require('express'); const path = require('path'); const http = require('http'); const bodyParser = require('body-parser'); const coinTicker = require('coin-ticker'); const api = require('./server/routes/api'); const app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'dist'))); app.use('/api', api); app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'dist/index.html')); }); const port = process.env.PORT || '3000'; […]

stripe angular错误:Uncaught(在promise中):TypeError:无法读取未定义的属性'stripeService'

我目前正在尝试实现条纹到我的angular4 nodejs应用程序,但我有点卡住了,当我试图通过我的服务发送卡令牌到我的服务器处理与条带相关的请求。 这是我得到的代码: stripe.component.html: <form role="form" id="payment-form"> <div id="card-element"></div> <div id="card-errors" role="alert"></div> <button type="submit" (click)="addCard()">Submit Payment</button> </form> stripe.component.ts: import {Component, OnInit} from "@angular/core"; import {WindowRef} from "../social/windowRef"; import {StripeService} from "./stripe.service"; @Component({ selector: "app-stripe", templateUrl: './stripe.component.html', styleUrls: ['./stripe.component.css'] }) export class StripeComponent implements OnInit { elements: any; stripe: any; style: any; card: any; constructor(private stripeService: […]

将Nodejs和Angular 2连接到SQL Server 2014

我正在使用Angular 2和Nodejs连接到SQL Server。 如果我简单地把下面的代码放在一个js文件中,并使用node test.js通过控制台运行,代码将正确删除logging。 这里是代码: var webconfig = { user: 'sa', password: 'test', server: 'localhost', database: 'Test', options: { encrypt: false // Use this if you're on Windows Azure } } var express = require('express'); var sql = require('mssql'); var http = require('http'); var app = express(); var port = process.env.PORT || 4200; var […]