angular6

Angular 6 application : Manifest: Line: 1, column: 1, Unexpected token

风格不统一 提交于 2019-12-11 19:47:21
问题 This error appears when the code is built and deployed to Azure. When the code is run locally using VSCode this doesn't appear in the console. Any help regarding this matter is appreciated. Manifest file code : { "name": "", "icons": [ { "src": "assets/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" } ], "theme_color": "#ffffff", "background_color": "#ffffff", "display": "standalone" } The file is referenced in the index.html as follows <link rel="manifest" href="assets

binding the data from component in HTML page : Angular 6

丶灬走出姿态 提交于 2019-12-11 19:46:19
问题 I'm new to angular 6 so please. I have my component.ts where i'm having my response. Now I want to bind data based on filter value in my HTML page. That is when the user clicks on the Owner Name . Now I want to display the owner name on the top right corner of my HTML page. How can I achieve that? Here is how my HTML page looks like. My component.ts page looks like this: import { CampaignService } from './../../../services/campaign.service'; import { Component, OnInit, Input } from '@angular

Angular 6: Storing value to use in *ngFor

梦想的初衷 提交于 2019-12-11 19:37:19
问题 In the loop body in the code below: <ul> <li *ngFor="let article of articles; index as i"> <a>{{ articles[i].title }} -- {{i}}</a> <p>{{ articles[i].body }}</p> <!-- i++ --> <p>{{ i }}</p> </li> </ul> Is there anyway to store the value of i++ at that position, then print out new value of i ? Then, i 's value is updated with the new value and used in the next loop. I would like to loop 2 elements at a time, not just one. It's just like what we can do in Java as below: for (int i = 0; i < 10; i

Why I have to use a Semi-colon before my code?

岁酱吖の 提交于 2019-12-11 19:15:33
问题 I have this code: this.userService.register(value).pipe( finalize(() => this.isRequesting = false) ).subscribe( () => this.router.navigate(['/login'], { queryParams: { brandNew: true, email: value.email } }), (error: any) => this.errors = error ); It doesn't work until I put a semicolon before this.router : () => ; this.router.navigate(['/login'], { queryParams: { brandNew: true, email: value.email } }), It is really weird, why should this be happening? It has nothing to do with this.router

How do I add an item to an Observable<Entity[]> type from an API response, if the Observable is being handled by the async pipe?

隐身守侯 提交于 2019-12-11 18:50:56
问题 So, I have the following service in an Angular 6 codebase: export class GenericService<T> { public endpoint: string; constructor(private http: HttpClient) {} public create(entity: T): Observable<T> { return this.http.post<T>(`${environment.apiUrl}/api/${this.endpoint}`, entity); } } As you can see, the observable create(entity: T) method returns the entity it creates. In the component, it is handled thus: @Component({ selector: 'app-brand-dialog', templateUrl: './brand-dialog.component.html',

Django to Angular 6: CSRF token missing or incorrect even though it's set in the headers

随声附和 提交于 2019-12-11 18:13:47
问题 I am trying to make a POST request from an Angular 6 app to a Django backend. Even though I include the csrf token in the headers, Django is logging a 403 Forbidden error as "CSRF token missing or incorrect". My code is as follows (with extraneous headers in my attempts to satisfy Django): Angular Component: import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { SharedService } from '../../shared.service'; import { CookieService }

Unexpected value xxx imported by the module xxx Please add a @NgModule annotation

这一生的挚爱 提交于 2019-12-11 18:12:28
问题 I'm attempting to convert an existing Angular app from 5.2.5 to 6.0.8. After some time struggling with an error, I've created a relatively straightforward repro which can be found here: https://github.com/DelphiWorlds/Angular6Issue The error on my machine comes out as: ERROR in : Unexpected value 'TestModule in C:/Source/angular6issue/test/app/node_modules/test-package-a6/dist/index.d.ts' imported by the module 'AppModule in C:/Source/angular6issue/test/app/src/app/app.module.ts'. Please add

how i can preview files(documents and images) in angular 6?

笑着哭i 提交于 2019-12-11 17:56:39
问题 I am using angular 6 and need to preview files which are present in some path. I need to preview any file type like img,doc,pdf,excel etc(All office documents). Is there is any single library which support both or need to use different for the same. Please let me know if i can follow any example or any link Thanks in advance. 回答1: @gaurav This is great https://www.npmjs.com/package/ngx-doc-viewer Cheers! 回答2: Each format has its own viewer (PDF, IMG, VIDEO). I do not remember any plugin to

Angular 6 Error: Cannot find a differ supporting object of type 'string'

浪子不回头ぞ 提交于 2019-12-11 17:52:07
问题 As you can see by the subject, I am receiving this error because one of the columns in the database is a string of JSON and I thought I could get around this by having an ngFor loop within an ngFor loop. The following is the html: <tbody> <tr *ngFor="let item of mf.data"> <td>{{ item.id }}</td> <td>{{ item.user_id }}</td> <td class="text-right">{{ item.orders_id }}</td> <td> <ul *ngFor="let x of item.product"> <li>{{ x.name }}</li> <li>{{ x.price }}</li> <li>{{ x.category }}</li> <li>{{ x.ts

Angular 6 - Children paths of lazy loaded module are not loading

扶醉桌前 提交于 2019-12-11 17:45:04
问题 I am trying to work with routing in lazy loaded modules, but it is not working. This is my app module routing. export const routes: Routes = [ { path: '', component: DefaultLayoutComponent, data: { title: 'Home' }, children: [ { path: 'holiday', loadChildren: './holiday/holiday.module#HolidayModule' } ] }, { path:"**", component:P404Component } ]; This is RoutingModule for lazy-loaded module. const routes: Routes = [ { path: '', children: [ { path: '', component: HolidayBookingComponent }, {