Angular Add & Get Custom Attribute Value

Today, We want to share with you Angular Add & Get Custom Attribute Value.In this post we will show you angular add attributes to element, hear for how to get data by id in angular 7 we will give you demo and example for implement.In this post, we will learn about Get Custom Attributes Value in Angular? with an example.

Angular Add & Get Custom Attribute Value

There are the Following The simple About angular 6 get element by id Full Information With Example and source code.

Read Also:  How to change background image of a div with JavaScript/jQuery and CSS?

As I will cover this Post with live Working example to develop attributes binding in angular 7, so the how to get data by id in angular 4 is used for this example is following below.

How to Add & Get Custom Attribute Value in Angular?


import { Component } from '@angular/core';
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
export class AppComponent  {
  name = 'Angular';
  websites = [
    {id:1, name:"pakainfo"},
    {id:2, name:"ministackoverflow"},
    {id:3, name:"infinityknow"},
    var id = e.getAttribute('data-id');


<h1>angular add and get custom attribute to element -</h1>
  <li #websiteID *ngFor="let website of websites" []="">
    <button (click)="clickEvent(websiteID)">{{ }}</button>

Web Programming Tutorials Example with Demo

Read :

Read Also:  Laravel 5.7 Routing Optional Parameter


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about how to get data by id in angular 4.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.