angular5

Load new modules dynamically in run-time with Angular CLI & Angular 5

风格不统一 提交于 2019-12-17 03:52:12
问题 Currently I'm working on a project which is being hosted on a clients server. For new 'modules' there is no intention to recompile the entire application. That said, the client wants to update the router/lazy loaded modules in runtime . I've tried several things out but I can't get it to work. I was wondering if any of you knows what I could still try or what I missed. One thing I noticed, most of the resources I tried, using angular cli, are being bundled into seperate chunks by webpack by

angular 5 application is working on edge but failing on ie11

回眸只為那壹抹淺笑 提交于 2019-12-14 02:29:57
问题 My angular 5 application which is running on angular cli is not working on ie11. What makes me wonder is the application is fine on edge. I have my ployfills set for both ie and edge. On ie11 application is throwing 'ERROR TypeError: Object doesn't support property or method' errors. Please look at my ployfills.ts, tsConfig and angular-cli and let me know what is missing. I tried commenting web-animations polyfills but no luck. polyfill.ts /** * This file includes polyfills needed by Angular

Server Side Rendering Angular 4/5 Issue

白昼怎懂夜的黑 提交于 2019-12-13 22:14:08
问题 I am working on angular 5. I am done with my app and created a build and deployed on the server and it works fine. But I have issue with Search Engine Optimization that pages are not indexed in google. I used Server Side Rendering and have the below error: F:\universal-demo-v5>node dist/server.js F:\universal-demo-v5\dist\server.js:111436 })(window, document, 'Hammer'); ^ ReferenceError: window is not defined at Object.defineProperty.value (F:\universal-demo-v5\dist\server.js:111436:4) at _

How can I apply different (full page) backgrounds for different Angular 5 pages?

让人想犯罪 __ 提交于 2019-12-13 21:11:25
问题 Currently I am using Angular 5 to make an SPA. I want to fill the entire screen with a background (not just one component) but I want different backgrounds for each page, how can I achieve this? I have tried this code in the component.css of the concerning page (for example home.component.css): body { background-color: aqua; } (using background-color as an example) Using this method, I thought I could override the main body background per component but it does not seem to work, the page

Angular 2/5. Service with HttpClient makes mistake and doesn't works

孤人 提交于 2019-12-13 21:04:38
问题 I'm trying to make service which takes (trying to take) XML-file from remote server. I haven't enough experience to find mistakes by myself. Relevant code of app.component.ts : import { Component, OnInit, AfterViewInit, ElementRef, ViewChild, Renderer2 } from '@angular/core'; import { CanvasSettings } from './canvas-settings'; import { Rate } from './rate'; import { RateService } from './rates.service'; import { CBRRateService } from './cbrrates.service'; import { DatePoints, Year, Month, Day

Angular HttpClient: Convert HttpResponse to Response

亡梦爱人 提交于 2019-12-13 20:41:59
问题 While using Http we get response type as Response from @angular/http library, similarly converting to JSON using res.json() But by using HttpClient from @angular/common/http we get direct JSON or HttpResponse by using observe Is there any work around to convert type from Response to HttpResponse or any other way to get response from HtpClient so that .json() will work? 回答1: http client by default calls res.json() implicitly and you don't need to that manually yourself and set the respond type

Angular 5 Subscribe read HttpStatusCode 204

拥有回忆 提交于 2019-12-13 20:28:39
问题 I am using Angular 5 in the project and making API calls to fetch the data. Example code:- this.userSvc.addPhone(this.userID, this.countryCode, this.phoneNumber) .subscribe(data => { console.log('Phone Added Successfully') }, (err: HttpErrorResponse) => { console.log(err.message) }); userSvc Function :- addPhone(userId, countryCode, phoneNumber) { return this.HttpClient.Post(this.rootUrl + "add-phonetouser?id=" + userId + "&countrycode=" + countryCode + "&phonenumber=" + phoneNumber , {

Error trying to diff '[object Object]'. Only arrays and iterables are allowed in angular

怎甘沉沦 提交于 2019-12-13 20:26:36
问题 I'm trying to display the data on the front end but i get the above error. How to resolve this? service.ts rec_source(){ var headers = new HttpHeaders().set('Authorization', 'Token ' + localStorage.getItem('usertoken')); headers.append('Accept', 'application/json'); var options = { headers: headers }; return this.httpClient.get('api/recruit/fetch_recruitment_details',options) } component.ts sources:any = []; constructor(private Authentication:AuthService) { } ngOnInit() { this.Authentication

edit and delete operation in angular

匆匆过客 提交于 2019-12-13 20:06:48
问题 I'm building a crud operation and was able to do the create operation. Now I'm trying to edit and delete them. I tried getting individual data through service but failed. It would be nice if anyone could help me with this. service.ts // Fetch Role Data getRoleData(){ var headers = new HttpHeaders().set('Authorization', 'Token ' + localStorage.getItem('usertoken')); var options_role = { headers: headers }; return this.httpClient.get('api/auth/role/', options_role); } // Add Data sendRole(data)

Angular Material Table Width 100%

…衆ロ難τιáo~ 提交于 2019-12-13 17:19:09
问题 I'm using material table inside angular material card. Here is my code: <mat-card style="margin: 5px;font-family:Arial, Helvetica, sans-serif!important;font-size:10px !important;" class="mat-elevation-z15" fxFlex> <mat-card-content fxLayout="column" fxLayoutAlign="space-between" fxFlex> <h4>Incidents</h4> <mat-table #table [dataSource]="dataSource" matSort class="mat-elevation-z8"> <ng-container matColumnDef="number"> <th mat-header-cell *matHeaderCellDef mat-sort-header>Number</th> <td mat