angular6

Angular 6 Property 'map' does not exist on type 'Object'

放肆的年华 提交于 2019-12-05 01:26:47
问题 I have a api which return objects / array like this: (2) [{...}, {...}] object 0: {a: '1', b: {id: '1'}} 1: {a: '2', b: {id: '2'}} So it looks like array of objects (but debuges says 'Object'). So in my code I have: return this.http.get(this.url).pipe( map(datas => { return datas.map(data => { let object = { a: data['a'], b: data['b']['id'], } return object; }) }) ); but there: return datas.map(data => { I got an error: Property 'map' does not exist on type 'Object'. But application is

How can I disable AOT in angular2?

为君一笑 提交于 2019-12-05 01:21:19
问题 I got something like this: ng build --prod --no-aot But I am not able to understand what is the difference between ng build --prod and ng build --prod --no-aot 回答1: Update: For Angular 6 Use the following command to disable AOT mode: $ ng build --prod --aot=false --build-optimizer=false 回答2: Just run command ng build -prod -aot=false . This will disable the aot compiler. 回答3: The flag --prod does the AOT compilation by default. If you want to build without AOT then simply run ng build only

Cannot read property 'ngMetadataName' of undefined

依然范特西╮ 提交于 2019-12-05 00:38:29
I am using Angular 6 with Angular Material. After updating to the latest version, the console is throwing this error in development. On Production it is working Cannot read property 'ngMetadataName' of undefined It occurs when I am trying to open material dialog via a service ( without a service they are working fine). I think it is related to the Injectables, but I am not sure. Versions: cli: 6.1.5 , core: 6.1.4, material: 6.4.6 Here is the log stack: CustomDialogComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'ngMetadataName' of undefined at injectArgs (core.js:1418

Unknown option --extractCss in AspNetCore Angular 6.0 SPA Template

谁说胖子不能爱 提交于 2019-12-05 00:29:57
I have scaffolded AspNetCore Angular 6.0 SPA template from cli and then installed npm package accordingly. However when i try to run the project dotnet run it does not start rather prompted with and error. I have captured a screenshot for your reference. I am not sure whether it is something to do with angular.Json file or else!!! Any idea.. Error: Unknown option --extractCss This is because the ng serve command no longer supports --extractCss option Open package.json . You'll find { "scripts": { "start": "ng serve --extract-css" // Please remove the --extract-css // ... } } remove the -

@angular/platform-browser/platform-browser\"' has no exported member 'HammerLoader'

坚强是说给别人听的谎言 提交于 2019-12-05 00:25:16
I tried to run "ng build", I'm getting following error. "ERROR in node_modules/@angular/material/core/typings/common-behaviors/common-module.d.ts(9,10): error TS2305: Module '"../Frontend/node_modules/@angular/platform-browser/platform-browser"' has no exported member 'HammerLoader'." pacakge.json contain with "@angular/platform-browser" and "@angular/material". I'm trying to use here angular material table. I couldn't figure it why this error is coming and the possible solution. Check the @angular/material version, the new version only work with angular 7. Try install older version (p.e npm i

Angular 6 Role based Authentication

99封情书 提交于 2019-12-04 22:55:40
I have 5 modules in my project. roll access to these modules in create, update, delete and view access based on rolls. How I create UI in angular 6 and I need the role when user login to the app and setting the role in shared service. for example admin roll access all the services and employee role only view the list not access to create and delete. I'm new to entering in angular. Please help me any codes or examples in Roll based authentication You can create different component and render the component conditionally. Consider your example. For that I create 2 component 1. view component 2.

Angular NoopAnimationsModule Type Error matches Element is not a function

我们两清 提交于 2019-12-04 22:47:48
I'm getting this error after importing NoopAnimationsModule for my Angular 6 app ERROR TypeError: this.driver.matchesElement is not a function at TransitionAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TransitionAnimationEngine.processLeaveNode (browser.js:2976) This happened to me a few hours ago, and was probably caused by some outdated modules. Running npm update --save fixed it. @angular/core and @angular/animations should be same version. Especially look for "^" symbol in package name in package.json . It should be "@angular/core": "6.0.5", "@angular/animations"

How can I use two translators first for JSON file and second for firestore?

不问归期 提交于 2019-12-04 20:42:55
JSON File Method export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); } JSON File Loader TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } }), AngularFirestore Method export function FirestoreTranslationsLoaderFactory(db: AngularFirestore) { return new FirestoreTransLoader(db); } AngularFirestore File Loader TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: FirestoreTranslationsLoaderFactory, deps: [AngularFirestore] } }), Note: I

Angular 6 load css folders in angular.json

ε祈祈猫儿з 提交于 2019-12-04 19:33:57
问题 I am trying to convert my html template into angular app. I have a css folder called plugins and img folder. When I am adding : "styles": [ "src/assets/plugins/listtyicons/style.css", "src/assets/plugins/jquery-ui/jquery-ui.min.css", "src/assets/plugins/bootstrap/css/bootstrap.min.css", "src/assets/plugins/plugins/isotope/isotope.min.css", "src/styles.css" ] this code in angular.json file I am getting error when trying to start angular app. I have put my plugin folder inside assets folder. I

Global is not defined at ../node_modules/socket.io-parser/is-buffer.js

删除回忆录丶 提交于 2019-12-04 18:47:10
问题 thanks in advance for helping me out. I'm trying to connect socket in one of my angular components, but in the console of the browser it throws an error saying that global is not defined at Object ../node_modules/socket.io-parser/is-buffer.js This is my home.component.ts import { Component, OnInit } from '@angular/core'; import * as $ from 'jquery'; import * as io from 'socket.io-client'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component