angular

Angular universal flickring with Transfer state

▼魔方 西西 提交于 2021-02-09 11:59:28
问题 I am using angular 7 and nodejs express for backend API, I am using angular universal for server-side rendering for SEO perspective After SSR website is flickering, I am using JWT token-based authentication and sending token in every Http request for check token is valid or not For remove flickering, I have tried multiple ways to avoid flickering Using Transfer state for manage caching and avoid duplicate https request, it's working perfectly but the problem is I am not getting token from

Get Jenkins BUILD_NUMBER variable and display it in angular application

只谈情不闲聊 提交于 2021-02-09 11:52:26
问题 I deploy an angular application by Jenkins and I want to display the build number in the footer of the page. I know that while Jenkins is running the job, it sents a system environment variable BUILD_NUMBER. I read some articles but none is saying how can we get this variable from the OS? 回答1: Here is a workaround. You can use pre and post build event to replace a version-tag in environment.prod.ts file. export const environment = { production: true, system: 'prod', version: '%VERSION%' };

npm run start working whereas ng serve not working

假如想象 提交于 2021-02-09 11:49:05
问题 I try to run angular 2 app with ng serve in Linux machine. It is not working. But I tried npm run start command. It is working fine. I got the following message when I tried ng serve command. As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release, which will only support Node 6.9 and greater. This package will be officially deprecated shortly after. To disable this warning use "ng set --global warnings.packageDeprecation=false". You have to be inside an

Should I use readonly on injected Angular services instead of making them public?

旧城冷巷雨未停 提交于 2021-02-09 11:45:49
问题 I had a discussion today where some of my colleagues said that they inject their Angular services like that: constructor(readonly language: I18nService) They said they do this because it prevents consumers of my component to change the injected service, kinda like that: @Component({ ... }) class ComponentA { constructor(public language: I18nService) {} } @Component({ ... }) class ComponentB { @ViewChild(ComponentA) compA: ComponentA; constructor() { this.compA.language = new I18nService(); }

Can I Auto read OTP on Mobile Browsers?

℡╲_俬逩灬. 提交于 2021-02-09 11:11:13
问题 I am working on auto reading a login OTP on a mobile browser. My web application is built in Angular 7. Once the user clicks on login, an OTP is sent via AWS to the user's mobile with a 6 digit code. I have looked up Google's SMS Retriever API but it does not help my case. Is reading an OTP from a mobile browser possible? 回答1: Yes, this is possible now. Chrome release this feature in version 84 and above. With the help of WEBOTP API we can detect OTP on the web for mobile devices. code - if (

Can I Auto read OTP on Mobile Browsers?

别说谁变了你拦得住时间么 提交于 2021-02-09 11:07:32
问题 I am working on auto reading a login OTP on a mobile browser. My web application is built in Angular 7. Once the user clicks on login, an OTP is sent via AWS to the user's mobile with a 6 digit code. I have looked up Google's SMS Retriever API but it does not help my case. Is reading an OTP from a mobile browser possible? 回答1: Yes, this is possible now. Chrome release this feature in version 84 and above. With the help of WEBOTP API we can detect OTP on the web for mobile devices. code - if (

Angular 2 HTTP Headers not being added to request

我们两清 提交于 2021-02-09 10:56:48
问题 I have the following http request in which I add the header to the request, however the request fails and when I look in the Network tab of the browser the request headers don't include the Authorization header. What am I missing here?: public get(address: string, callback: any): Observable<any> { let headers: Headers = new Headers(); headers.append('Authorization', 'Bearer <token>'); return this.http.get(address, { 'Headers': headers }) .map(callback) .catch((error: any) => this.handleError

Angular 2 HTTP Headers not being added to request

心不动则不痛 提交于 2021-02-09 10:53:01
问题 I have the following http request in which I add the header to the request, however the request fails and when I look in the Network tab of the browser the request headers don't include the Authorization header. What am I missing here?: public get(address: string, callback: any): Observable<any> { let headers: Headers = new Headers(); headers.append('Authorization', 'Bearer <token>'); return this.http.get(address, { 'Headers': headers }) .map(callback) .catch((error: any) => this.handleError

Angular 6 Library assets not included in lib after build

懵懂的女人 提交于 2021-02-09 09:38:05
问题 I have recently created an Angular library (ng new library) and had an issue after building it with the ng build --prod . My assets folder did not get copied to the dist folder and I can no longer reference my file. When I tried including the assets script in my angular.json I got an error - Schema validation failed with the following errors: Data path "" should NOT have additional properties(assets). Is there a way of including assets in an Angular library? Please help 回答1: I had the same

Angular 6 Library assets not included in lib after build

孤者浪人 提交于 2021-02-09 09:37:16
问题 I have recently created an Angular library (ng new library) and had an issue after building it with the ng build --prod . My assets folder did not get copied to the dist folder and I can no longer reference my file. When I tried including the assets script in my angular.json I got an error - Schema validation failed with the following errors: Data path "" should NOT have additional properties(assets). Is there a way of including assets in an Angular library? Please help 回答1: I had the same