angular6

[Angular-CLI-6]Could not determine single project for 'Serve' target

有些话、适合烂在心里 提交于 2019-12-05 07:20:54
I have updated my angular-cli with the help of ng update @angular/cli command. After that, I have got an error as Could not determine single project for 'server' target with following error trace. Could not determine a single project for the 'serve' target. Error: Could not determine a single project for the 'serve' target. at ServeCommand.getProjectNamesByTarget (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:175:19) at ServeCommand.<anonymous> (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:128:51) at Generator

Unable to reorder columns in angular ngx-datatable

寵の児 提交于 2019-12-05 06:26:04
问题 I am working on angular ngx-datatables, where I need to achieve its column reorder functionality. But its not working(not getting any error), also column's width is not changing on dragging the line. I have added below css files in angular.json file. Do it require any js file? "node_modules/@swimlane/ngx-datatable/release/components/datatable.component.css", "node_modules/@swimlane/ngx-datatable/release/themes/material.css", "node_modules/@swimlane/ngx-datatable/release/themes/dark.css",

Google Maps compatibility IE11 not working because of polyfills.js

99封情书 提交于 2019-12-05 04:15:22
问题 My app website is not working fine on IE11. The website is not loading, it gives me a blank page This is the error thrown on IE11 : SCRIPT5005: String expected js (26,286) SCRIPT5022: Exception thrown and not caught. polyfills.js (3234,3) I'm enclosing the screen capture on on the console I have included the API in my index.html like this : <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script> It should include googlemaps after my polyfills.js, but

Why mat-error not get displayed inside mat-form field in angular material 6 withcustom global validators

有些话、适合烂在心里 提交于 2019-12-05 03:58:55
i am using angular material 6 ,i have a vaidation inside mat-form-field mat-error is not displayed , when move after mat-form-field to the mat-error which is displaying properly. Not Working code: <mat-form-field> <input matInput type="time" formControlName="ToTime"/> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error> </mat-form-field> Working Fine: <input matInput type="time" formControlName="ToTime"/> </mat-form-field> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be

TypeError: rxjs__WEBPACK_IMPORTED_MODULE_2__.Observable.throw is not a function

筅森魡賤 提交于 2019-12-05 03:52:32
Here is my file userdata.service.ts : import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import {Observable} from 'rxjs'; import { map } from "rxjs/operators"; import { catchError } from 'rxjs/operators'; import { Data } from './userdata'; @Injectable() export class UserDataService { url : "http://localhost:4200/assets/data/userdata.json"; constructor(private http:Http) { } getDataWithObservable() : Observable<any>{ return this.http.get(this.url) .pipe( map(this.extractData), catchError(this.handleErrorObservable) ); } private extractData(res: Response)

Angular 6 StaticInjectorError: No provider for Options

假如想象 提交于 2019-12-05 03:33:48
I have recently updated my project from Angular5 to Angular6. The project is building successfully but I am getting the following error in the browser console: Unhandled Promise rejection: StaticInjectorError(AppModule)[options]: StaticInjectorError(Platform: core)[options]: NullInjectorError: No provider for options! ; Zone: ; Task: Promise.then ; Value: Error: StaticInjectorError(AppModule)[options] Any idea on how to debug these issues? Here's my app.module: import { BrowserModule } from '@angular/platform-browser'; import { ServiceWorkerModule } from '@angular/service-worker'; import {

Unable to downgrade Angular from version 6 to 5

孤街浪徒 提交于 2019-12-05 03:12:26
问题 Recently (May 2018) newer stable version of angular has been released. I have migrated succesfully from version 5 to 6. But for some reason I wanted to rollback to version 5. I have tried following commands: npm uninstall -g @angular/cli it uninstalled the latest version of angular-6. npm cache clean --force and then installed npm install -g @angular/cli@1.7.4 But it gave this error node version : 8.10.0 npm version : 6.0.0 回答1: you have to update npm...please refer to screenshot...I've

Angular 6 service with interface

≯℡__Kan透↙ 提交于 2019-12-05 03:03:36
I am building an application with Angular ( 6.0.7 ) and I am trying to create a service with the new: @Injectable({ providedIn: 'root' }) But how can I type an injection with an Interface? The problem I have 2 services, Authentication.service and SessionStorage.service . I want to inject the sessionstorage into the authentication service. That can be done via: constructor(private sessionStorage: SessionStorage) { } No problem there. But for Object Orientated purposes I want to have an interface above this service (so that I can implement both localstorage service as sessionstorage service).

directive click outside angular 6

拈花ヽ惹草 提交于 2019-12-05 03:00:07
I upgraded my Angular from 4 to 6, and consequently had a problem with my click-off policy, it stopped working on all components. my directive: import { Directive, Output, EventEmitter, ElementRef, HostListener } from '@angular/core'; @Directive({ selector: '[clickOutside]' }) export class ClickOutsideDirective { constructor(private _elementRef : ElementRef) { } @Output() public clickOutside = new EventEmitter(); @HostListener('document:click', ['$event.target']) public onClick(targetElement) { const clickedInside = this._elementRef.nativeElement.contains(targetElement); if (!clickedInside) {

Two way binding on angular 6 reactive form

蹲街弑〆低调 提交于 2019-12-05 01:41:54
I am trying to create a complex reactive form with nested component that is populated with a data object. The behavior I am trying to achieve is very similar to the two-way data binding of a template-driven form: when the user edits an input of the form, the data object is changing automatically . but as opposed to template-driven form, I cannot use [(ngModel)] because it is deprecated in reactive forms for angular V6. I know that fromGroup.patchValue() will only do a one way binding and then ill have to manually subscribe to change events and update the data object manually - this will result