angular5

Clicking the action part of @angular/service-worker push notifications

删除回忆录丶 提交于 2019-12-12 07:37:03
问题 I've been trying to redirect users to the "action" part of Webpush coming from the backend (PHP). return (new WebPushMessage) ->title('Title') ->icon('icon.png') ->body('Body Msg') ->action('Open Notification', 'open_notification') ->data(['id' => $notification->id,'url'=>'http://somewhere']); Default service workers use: self.addEventListener('notificationclick', function(event) { console.log('On notification click: ', event.notification.tag); event.notification.close(); // This looks to see

Angular 5 unable to get XSRF token from HttpXsrfTokenExtractor

北战南征 提交于 2019-12-12 07:36:19
问题 I am trying to make a POST request via an absolute URL to a Spring (Basic authentication) secured Rest API. Having read that Angular omits inserting the X-XSRF-TOKEN into the request header automatically for absolute urls, I tried to implement an HttpInterceptor to add the token in. In my original /signin POST request, I create the necessary authorization: Basic header to ensure Spring authenticates the request. The response header returned contains the expected set-cookie token: Set-Cookie

Angular 5 material new palette not compiling

…衆ロ難τιáo~ 提交于 2019-12-11 18:27:17
问题 I'm trying to generate a new material theme with a custom palette for the primary color, the scss code is below: @import '~@angular/material/theming'; @include mat-core(); $potti-brown: ( 50: #fcf2e7, 100: #f8dec3, 200: #f3c89c, 300: #eeb274, 400: #eaa256, 500: #e69138, 600: #e38932, 700: #df7e2b, 800: #db7424, 900: #d56217, A100: #ffffff, A200: #ffe3d4, A400: #ffc3a1, A700: #ffb287, contrastDefaultColor: light, contrastDarkColors: ( 50, 100, 200, 300, 400, 500, 600, 700, 800, A100, A200,

Angular 5 Await Not Waiting

大憨熊 提交于 2019-12-11 18:17:48
问题 When I run the code below, the checkCard function runs before the getTimecard function is finished. getTimecard() { this._service.getTimecard().subscribe( data => { this.sending = true; this.timecards = data; }, err => { this.sending = false; console.error(err); }, () => { this.sending = false; } ); } checkCards() { console.log('timecards', this.timecards); //code dependent on timecard data } async onSubmit() { await this.getTimecard(); this.checkCards(); } Why Isn't checkOverlap waiting for

@Injectable service does not seem to be a singleton

你离开我真会死。 提交于 2019-12-11 17:52:36
问题 I have an Angular service like so: @Injectable export class MyService { foo = true; fireTheCallback(){ assert(this.foo === true); // this is correct this.cb(); // this.cb is not defined } } I inject that service into a component: @Component({providers:[MyService]}) export class MyComponent { constructor(data: MyService){ data.cb = v => { // attach this callback function to the service } } } after the service is created, we call fireTheCallback() but this.cb is not defined. It's not an issue

ERROR Error: ExpressionChangedAfterItHasBeenCheckedError in Angular 5

夙愿已清 提交于 2019-12-11 16:54:27
问题 I am new to angular 5 ,Here I am trying to disable a input field based on the condition. <div *ngIf="isOTPFieldEnabled" class="email-field-width"> <mat-form-field class="email-field-width"> <mat-label> Enter OTP</mat-label> <input [attr.disabled]="isDiableSignInOTPField" #OTP (click)="getOTP(OTP.value)" [formControl]="signInOTP" maxlength="6" matInput required placeholder="OTP"> <mat-hint [ngStyle]="{color: hintColor}">{{hintOTP}}</mat-hint> </mat-form-field> </div> After the page load this

How do I bind values of edit form with array of object in angular 5?

房东的猫 提交于 2019-12-11 16:47:52
问题 I have an Array of Student Objects. The interface looks something like this: interface Student { title: string; firstName: string; lastName: string; dob: string; age: number; } I want to edit title , firstName & lastName . The form will have array of student objects. There is already some data in objects fetched from db. title is a dropdown, firstName and lastName are textboxes. There will be a save button, on click of which the values of the form should be bundled and sent through Student[]

Angular 5 : no css appearing and can't go to other pages after ng build --prod

北城余情 提交于 2019-12-11 16:44:56
问题 No css are being appeared and unable to browse other pages except the index, after I run the ng build -- prod command in terminal. The index.html under dist is looks below: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>ShoptoMyDoor</title> <base href="/"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <script src="https://ajax.googleapis.com/ajax/libs

Angular 5: Testing a service using window

大憨熊 提交于 2019-12-11 16:10:35
问题 I have a service that has a method that checks the available browser quota storage and returns an Observable: import { Injectable } from "@angular/core"; import { Observable } from "rxjs/Observable"; @Injectable() export class StorageService { hasAvailableStorage(): Observable<boolean> { const nav: any = navigator; return Observable.create(observer => { nav.webkitTemporaryStorage.queryUsageAndQuota( (usedBytes, grantedBytes) => { observer.next(usedBytes <= grantedBytes * 0.8); } ); }); } } I

Angular 6 Reactive Forms Custom Validator getting error shown from Default Data

馋奶兔 提交于 2019-12-11 15:41:19
问题 I have a FormArray in a FormGroup and each of the FormArray has multiple FormGroup's and can add them dynamically. I have a Custom Validator where it checks with all the data in each of the FormArray to validate the repetition of data. Currently, it's also validating the initial data with itself which is throwing an error. Is there any way to restrict the error from throwing itself when it's checking the initial data.? It's working fine when new data is added and has same values as the