News Articles angular

Hey, can anyone explain me this line of code?

<button [disabled] = " username === ” " (click)=" username = ” ">Reset User</button> In my app.component.ts I only have this variable: "username = ”;" Source: JavaSript – Stack Overflow

Check in Angular HTML template if input value already exists in array

I know this kind of question has been asked several times, but having checked all the answers I haven’t found the solution. In my HTML template I want to check if the input value already exists in the numbers array. If it exists a message is shown. I thought to solve this problem with ‘indexOf’ […]

Problem with ternany operator and nullish ? using js/ts and Angular

I have a problem with the ternary operator Check my code: {{ (first.calculatedAtUtc ?? first?.calculatedAtUtc) ? second.calculatedAtUtc : myVar.value }} I got error : RROR Error: Angular JIT compilation failed: ‘@angular/compiler’ not loaded! JIT compilation is discouraged for production use-cases! Consider AOT mode instead. Did you bootstrap using ‘@angular/platform-browser-dynamic’ or ‘@angular/platform-server’? Alternatively provide the compiler […]

How do set margin between cards?

I am using @angular/flex-layout. And I want to place four cards in a row. When set cards to stick to each other. But if use margin, then the card goes down to a new line and an empty space appears on the side. How to fix it? <div fxLayout="row wrap"> <div fxFlex.gt-md="0 1 25" fxFlex.gt-xs="0 […]

How does a compiled vue.js or angular component work? Can you use it like a normal, plain HTML project?

The title might be a bit confusing. I think i’m missing some basic understanding of how a framework like vue.js or even angular works once compiled. Can i technically, just take the compiled html/css/js, and run it standalone? As an example: If i create a component, lets say its a navigation component. Could i just […]

Column tbody height not being applied using calc in Firefox

I have a simple table with an header and a table content that has a fixed height. It works perfectly in Chrome, Edge and IE11, but not in Firefox. The table is structured like that: <table> <thead> <tr> <th>…</th> <th>…</th> <th>…</th> </tr> </thead> <tbody> <tr> <td>…</td> <td>…</td> <td>…</td> </tr> … </tbody> </table> The table is […]

Form array inside another Form array

https://stackblitz.com/edit/angular-ivy-hnusqs?file=src/app/app.component.ts I am able to push data to normal form arrays but I am unable to push Object data into nested form array and expected form data is { "templateTCSections": [ { "id": 43, "version": null, "sectionnumber": 1, "title": "Service", "templateTCText": [ { "id": null, "version": null, "paragraphnumber": 1, "value": "AT&T Consolidated Statement Service", "requiresspecialbid": […]

Javascript capitalize string with hyphen

I’ve array of string and want to make it capitalize. have looped to the array of strings and want to make first letter and letter after hyphen capitalize and remove hyphen locales= [‘es-US’, ‘en-US’, ‘en-CA’, ‘fr-CA’, ‘ar’, ‘fi’, ‘hy’] for(const st of locales) { const basePkg = `locale${st.replace(/(-.)/g,function(x){return x[1].toUpperCase()})}`; console.log(basePkg); // I get output as […]

Chat panel flickering while on hover in angular 11

I have facing flickering issue while on hover in pane using angular. find the link for demo video. https://www.loom.com/share/c912b94e10574a86b7f97666b4e6b1ec Used the following css .chat-dialog { width: 450px; height: 600px; max-height: calc(100vh – 100px); position: fixed; border-radius: 0px; bottom: 0px; right: 15px; z-index: 10; .messages { max-height: 440px; min-height: 440px; } &.expanded { height: calc(100vh – […]

Displaying Multiple Data-content on hover in angular

I have a requirement in which when I hover on div two dates should display accordingly which I am fetching dynamically. Below is the code I have written for hover effect:- <a data-trigger="hover" title="Remarks" [attr.data-content]="data.timeline[‘Initial Site Measurement Request’].ideal | date:’dd/MM/yyyy – h:mm a’,data.timeline[‘Initial Site Measurement Request’].ideal | date:’dd/MM/yyyy – h:mm a’" class="pop" (mouseenter)="openpopup($event)"><div *ngIf="data && […]

How to pass grid-row and grid-column dynamically to angular div tab using [ngstyle] by passing object

I’m trying to make grid-row and grid-column to be dynamically populated from API component.html <div *ngFor = "let element of elements"> <div [ngStyle]="styleObject(element.Row,element.Column)">{{element[‘Tool Name’]}}</div> </div> component.ts styleObject(row : String,Column:String): Object { let obj :Object; obj = {‘grid-row’:”+Number(row),’grid-column’:”+Number(Column)}; console.log(obj); return obj.toString; } This way in the console it is printing but it’s not reflecting in UI. […]

How to make a link work inside a clickable row

I have a link that is in a table row that is clickable. How would I go about making the link clickable to where I am not clicking the hole row but just that link? Any help with this would be greatly appreciated. How do I get my tooltip icon to be able to click […]

Angular Elements – Is it Possible to Data Bind Inputs?

I’ve searched everywhere on the internet and I cannot figure out the answer. I was wondering if it was possible to data bind an Angular Element’s input AFTER its been turned into a script and brought into plain HTML/JavaScript files. I’ve tested data binding an Angular Element within an Angular environment and it worked fine. […]

Building the Same App 5 Times

This is something that I was inspired to do because of the YouTube channel Fireship, which makes great videos about web development that I highly recommend if you’re interested. Here’s the original video, which includes 10 frameworks to build a todo application: https://youtu.be/cuHDQhDhvPE I figured I didn’t want to spend forever doing this, and I […]

Angular loop json display data

I want to make a loop to display data from my json but I am blocked on how to do it, I am quite a beginner and I want to know the best way to do it. The question is how can I display the value ‘name’ knowing that there are keys with different names? […]

mat-icon does not center in mat-button

When I make the font bigger the mat-icon is no longer centered. how can I center the icon inside of the button vertically and horizontally? (Note that the class "mat-icon" is built-in so the css does work specifying the class in the element) html: <button mat-fab class="add-picture"> <mat-icon>add_to_photos</mat-icon> </button> css: .add-picture { width:100px; height:100px; } […]

Impossibilty to declare a number to an @input in angular project

I just started with angular and am just looking to declare that I am expecting a number and not a string in an object in an array and I can’t get it, I don’t understand what is wrong. .. When I declare a number to the loveIts value (like that => loveIts: 3) it crashes […]

Angular – reload page when tab is selected?

Is there a way to trigger a function to reload the page when the user clicks the browser tab of my Angular app? I believe this would be done with window.location.reload(), but I’m not sure how to make this line be triggered on tab selection. I’m thinking this could be done by making the body/html […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.