Tag: 量angular器

用angular2 observablesasynchronous填充Object属性?

我想转换一个angular2组件来使用asynchronous数据调用。 我使用专用图表库将数据显示在图表上。 图表需要以某种格式传递数据(如下所示)。 public barChartData: any[] = [ { data: this.dataService.getCellOEE('powders'), label: 'OEE' } ]; 问题是this.dataService.getCellOEE('powders')返回一个可观察的。 如果我像[datasets]="(barChartData | async)"一样绑定到图表对象, [datasets]="(barChartData | async)"抛出一个错误,因为显然barChartData是一个对象而不是可观察对象。 我如何asynchronous使用已parsing的Observable数据填充静态对象的一部分,然后将该静态对象绑定到我的Chart UI组件的datasets属性?

search数组Mongoose中的对象

假设我有一个叫做部门的模型。 我有一个房间arrays,每个房间都有一个病人(有病人)。 我想让耐心等待请求的病人。 有没有办法做到这一点? var department = mongoose.model('department', { departmentName: String, rooms: [ { roomNumber: String, width: Number, height: Number, posX: Number, posY: Number, sanitary: Boolean, childcareArea: Boolean, lounge: Boolean, patient: { patientnr: Number, firstname: String, lastname: String, reasonOfHospitalization: String, dateOfHospitalization: Date, expectedDateOfDischarge: Date, vegetarian: Boolean, needsHelp: Boolean, comments: String, department: String, roomNumber: String, nextTreatment: […]

资产优化中的Angular-cli'JavaScript堆内存不足'

我正在Angular-cli项目中创build一个传单地图。 地图图块本地存储在“资产”文件夹中,因为它是栅格地图。 问题是,当我有很多缩放级别的地图时,我已经有超过280万个图像,大小约为1.1GB,而且会变大。 当我使用ng serve这里是控制台输出(它被卡住@资产优化): ** NG Live Development Server is running on http://localhost:4200. ** 25234ms building modules 69ms sealing 0ms optimizing 0ms basic module optimization 96ms module optimization 1ms advanced module optimization 16ms basic chunk optimization 0ms chunk optimization 1ms advanced chunk optimization 0ms module and chunk tree optimization 179ms module reviving 9ms module […]

防止ts文件被发送

我正在使用Angular-CLI的节点JS,我看到我的.ts文件正在通过HTTP发送到客户端。 例如http://localhost/main.ts将发送用户我的main.ts文件。 据我了解,在发送给浏览器之前,ts正在被转换成js文件,我正确吗? 如果是这样,我怎样才能防止.ts被发送,并使服务器只发送.js文件? 谢谢

量angular器与frisby API的集成

我正在尝试将frisby api与量angular器进行整合。 // An example configuration file. exports.config = { //seleniumAddress: 'http://localhost:4444/wd/hub', directConnect: true, // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' }, // Framework to use. Jasmine is recommended. framework: 'jasmine', // Spec patterns are relative to the current working directory when // protractor is called. specs: ['/usr/local/lib/node_modules/protractor/SpecFiles/frisby_global_spec.js'], // […]

在typescript(angular2)应用程序中joinnode_module

我尝试加载我的打字稿添加此模块。 首先,我添加了npm包,模块已经正确安装在我的node_modules文件夹中作为简单simpl-schema 。 由于这个包没有types,我添加了这一行: declare var SimpleSchema: any; 我尝试import * as SimpleSchema from 'simpl-schema';导入包含import * as SimpleSchema from 'simpl-schema';的包import * as SimpleSchema from 'simpl-schema'; 并得到消息Cannot find module 'simpl-schema' 。 我认为这是因为简单simpl-schema不包含types信息,但我不确定。 我在这里发现了很多关于这个话题的问题,在reddit和其他论坛上有很多build议,这对我的设置不起作用。 所以我想知道这是什么正确的方法。

Angular 2-Angular cli – build立项目

我是Angular 2的新手。 我开发了一个小项目,使用angular-cli生成包装,成功生成dist文件夹。 但是当我部署这个应用程序到服务器,并点击index.html页面,页面无法访问捆绑js文件。 捆绑后的Index.html :: <head> <meta charset="utf-8"> <title>MyApp</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <!– Latest compiled and minified JavaScript –> <script src="//rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.js"></script> <link href="styles.d41d8cd98f00b204e9800998ecf8427e.bundle.css" rel="stylesheet"></head> <body> <app-root>Loading…</app-root> <script type="text/javascript" src="inline.d41d8cd98f00b204e980.bundle.js"></script><script type="text/javascript" src="styles.b2328beb0372c051d06d.bundle.js"></script><script type="text/javascript" src="main.83a76acd0c370402d4d0.bundle.js"></script></body> angularcli.js { "project": { […]

我可以使用没有节点的Angular 2,但与Visual Studio?

我在一个项目中使用Visual Studio中的Typescript使用AngularJS 1。 我发现这篇文章解释了如何使用ngUpgrade慢慢地进入Angular 2.x +。 我一直无法弄清楚如何让Angular 2下载/安装以及如何将文件包含到我们的项目中。 使用AngularJS 1,我们下载了angular.js文件,使用a将其包含在页面中,然后离开。 我们没有运行节点,因为Visual Studio内置了打字稿支持和编译。 有人可以帮助我理解如何下载Angular 2和ngUpdate,并将其包含在我的页面(已包括Angular 1)中,并让Visual Studio做打字稿而不是使用Node?

Angular2路由器和Express集成

我在使用Angular2路由器时遇到了问题,但是以前的问题似乎没有解决scheme。 我正在使用angular2-cli的最新版本。 当我将浏览器指向localhost:3000时,我得到了angular2-cli生成的通用“app works”消息。 当我尝试导航到我的一个子路由时,例如localhost:3000 / auth / login,它会将我redirect到同一个“应用程序作品”页面,而不是显示“login作品” 。 看看堆栈交换的其他问题,我认为这个问题在这里: app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'dist/index.html')); }); 当我用*replace*时,而不是redirect到我的目标页面,它给了我无法GET错误。 总之,我的问题是我的angular2路由集成到我的快速应用程序的url导航无法正常工作。 我在server.js中的快速代码如下所示: var express = require("express"); var app = express(); var bodyParser = require("body-parser"); var mongoose = require("mongoose"); var path = require("path"); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended:true})); app.use(express.static(path.join(__dirname, 'dist'))); // Catch all other routes and return the index […]

Angular 2testing不能加载自定义包

我正在按照官方的angular2指南对现有项目进行testing。 我使用自定义库, downloadjs ,当我运行该应用程序时,它工作得很好。 但是在testing运行的情况下,在控制台中出现错误: "__zone_symbol__zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/downloadjs/download.js\n\tError: XHR error (404 Not Found) loading node_modules/downloadjs/download.js\n\tError loading node_modules/downloadjs/download.js as \"downloadjs\" from app/utilities/file-handler.utility.js" 我用npm install downloadjs来获得这个工具。 file-handler.utility.js如下: import {Injectable} from "@angular/core"; import downloadjs=require("downloadjs"); @Injectable() export class FileHandler{ public static download(fileToDownload: any) { downloadjs(fileToDownload, "filename.txt" ,"text/plain"); } } 我在同一个文件夹中创build了一个defs.spec.ts文件: declare module […]