Questions tagged dom

Explore the latest questions and answers asked by our top developers.

Updating SelectElement with AngularJS ng-model Using Javascript for Chrome Extension?

I am trying to change the value of a select element on a 3rd party website using a chrome extension, plain vanilla javascript. I cannot change the HTML on the website. From what I can tell, the select element is controlled with ng-model. I can’t seem to get this to update!! I can successfully update […]

Page scrolls if DOM api is called on an element inside a child component in Angular

I have a parent component with a component inside @Component({ selector: ‘report’, template: ` <div *ngFor="let report of reports"> {{ report }} <tags-ui [tags]="tagsData"></tags-ui> </div> `, styles: [] }) export class HelloComponent { reports = []; counter = 0; tagsData: Tag[] = [{ id: 1, name: ‘Bishkaan’ }, { id: 2, name: ‘Pakistan’ }, { […]

By oomer
Categorized as angular, dom, javascript, scroll Tagged , , ,

angular 12 Universal, failling html validation with error on routerLink attribute [duplicate]

Any ideas what to do, with this error? RouterLink attribute fail W3 HTML validation? The template is a simple HTML like <a [routerLink]="data.levelOneUrl" >{{data.levelOneName}}</a> Also, seems angular fail with all W3 validations, no just routerLink, but I have multiple issues with almost all attributes injected from angular Source: Angular Questions

Angular: way to know when all child components View are inited

Let’s say I have the main app.component with <router-outlet/> and this component can have multiple nested components. Some of them are very lightweight, some of them have tons of component-code + a lot of DOM objects, like images etc. It looks that when I use on my main app.component public ngAfterViewInit(): void { console.log(‘loaded: ‘, […]

By brabertaser19
Categorized as angular, dom, html, javascript Tagged , , ,

Angular DOMsanitizer URLs in a JSON file

I have a JSON with a several of this data example below. { "id": "2", "title": "The Pink Tail Fly", "url": "", "episode": "2", "season": "1", "likes": "26000", "source": "YouTube" } I would like to use the URL in a my angular project but Angular won’t let me unless I DOMsanitizer them. How can I […]

By JustCoder
Categorized as angular, dom, url Tagged , ,

Passing template with context in the google maps info window in Angular application

I’m using info window from the google-maps js API. I have used AGM, where I was able to pass my ng template with the required context. But currently I’m not using it and working with the javascript APIs only, in which I’m not able to pass in the template for the infoWindow. Basically, I want […]

Accessing attribute of an element inside a template and use it in other element in Angular

Is there a way to do the following <span data-value="apple" #customSpan> <span *ngIf="customSpan.magic.moreMagic === ‘apple’"> OMG! Its an Apple:)<span> <span *ngIf="customSpan.magic.moreMagic != ‘apple’"> Oh No! its not an Apple 🙁 <span> <span> whats that magic/moreMagics…? or is it not possible to do this way. Open to other ways too. Source: Angular Questions

By Maddy
Categorized as angular, dom, html, javascript, typescript Tagged , , , ,

Checkmarx Client DOM XSS violation in HTML

In Checkmarx scan report, I got the following Client DOM XSS violation The application’s <div class="modal-header"> embeds untrusted data in the generated output with value, at line 1 of /master.component.html. This untrusted data is embedded straight into the output without proper sanitization or encoding, enabling an attacker to inject malicious code into the output. The […]

By Hulk1991
Categorized as angular, checkmarx, dom, typescript, xss Tagged , , , ,

AngularJS. Can i inject styles along with the data

I have a custom decorator modifying an angular translate service. This service is returning a sample string. I need to style the data before returning it into its parent div (which is in another module I have no idea where). All the code I have is a translate service custom decorator and another a reference […]

By gman94
Categorized as angular-services, angularjs, dom, html, javascript Tagged , , , ,

Event listeners firing multiple times

I have a menu that appears when a container element is clicked, this is done by changing the menu’s display property from ‘none’ to ‘inline’ so that when the menu is not in use it is removed from the dom. When the menu is generated, each of its child elements (in this case list items) […]

1 14

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us