Category: Angular
-
UNIQUE ID inside an Angular Component
If you use an id for a HTML element inside your angular component and then use document.getElementById to retrieve it,bear in mind that someone can have multiple instances of your component on the same page. So here is a simple trick to deal with 1. In the HTML component put <div [id]=”‘htmlOutput’+myId”></div> 2. In the…
-
Integrating SPA ( Angular,React,Vue) with .NET Core for production
If you have a .NET Core WebAPI application ( that only serves data ) and a SPA application ( Angular,Vue, React) you can have just one application following this 2 steps: 1. In .NET Core add in Startup.cs ( with using Microsoft.AspNetCore.Builder from Microsoft.AspNetCore.StaticFiles ) app.UseDefaultFiles(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { // If…
-
Angular base href for web,desktop,mobile ( and paths for services)
My current stack is .NET Core (backend) + Angular ( frontend) ( For database,it is usual SqlServer – but I use Sqlite,Mongo,local storage ….) With Angular I can have Mobile application ( by Cordova ) and Windows Desktop ( with Electron) But the BaseHref it is a PIA …. even for Web,if you host into…
-
Interceptor in Angular–Error service
Similar video at https://www.youtube.com/watch?v=ajosuyhcKV4 I need to inform the user when the application is loading data with error ( i.e. the backend is giving some error back). And do it seamlessly,every time. I found the documentation about interceptors at https://angular.io/api/common/http/HttpInterceptor”– and you can find more searching on google / bing . Also,I have the need to…
-
Interceptor in Angular–loader and service
Video at https://www.youtube.com/watch?v=ajosuyhcKV4 I need to inform the user when the application is loading data – and when it is not loading anymore. Usually,the data comes from a backend via an HTTP call– and will be some timeout before it becomes available. So – simple – just intercept this and then show some spinning to the…
-
Covid Data – making the application – part 4
Now I need an application. The first version was a simple html file with Data Tables ( https://datatables.net/ ). You can find at https://ignatandrei.github.io/WFH_Resources/output.html . It is a simple table with search / filter and sorting. The next,with help from Bogdan we have started an Angular application,deployed at https://ignatandrei.github.io/WFH_Resources within the docs folder : http://github.com/ignatandrei/wfH_Resources/docs…
-
[ADCES] Online meeting about Angular
Because of the Government requiring advise for meeting,I have decided to make this meeting online. If you want to find what’s new in Angular 9,please follow https://youtu.be/_onm6pmhtYA
-
Caching data frontend- Angular interceptors for Observable–part 48
Now I want to cache data for fast loading site- if it comes next time with the same browser,should have some data returned fast – and then load from HTTP. So first return from cache,then make the request So I need to create an HTTP interceptor to cache things- fortunately,Angular already provide tutorial about this:…
-
RxJS–Unsubscribe automatically –part 47
I am searching for a simple method to unsubscribe from Observables. Some of methods are detailed here : https://blog.bitsrc.io/6-ways-to-unsubscribe-from-observables-in-angular-ab912819a78f I do not want remember to unsubscribe being forced to use html ( the async pipe) take operator – I want later to cache first data and then make the http call first operator – same…
-
Routing angular with .net core and RxJs switchmap- part 46
Now the problem is that the route works if I access first the index.html file,but it does not route when entered directly Trying to get from SPATemplate https://github.com/ignatandrei/InfoValutar/commit/a364dc57653ac2ba04ab0596f1540a8f9fdb73f6 However,this will redirect ALL routes to index.html – including swagger and API. Trying to learn more – looking at the code. I have observed that I…