Install the ngx-jdenticon and jdenticon NPM package.
npm install --save ngx-jdenticon jdenticon
Let Angular know that you will be using ngx-jdenticon by importing NgxJdenticonModule
into your app.module.ts
(or another module).
import { BrowserModule } from "@angular/platform-browser"; import { NgModule } from "@angular/core"; import { NgxJdenticonModule } from "ngx-jdenticon"; import { AppComponent } from "./app.component"; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, NgxJdenticonModule, ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
Add an icon to your app. You can choose to decorate either an <svg>
or <canvas>
element with the data-jdenticon-value
or data-jdenticon-hash
attribute.
<svg width="100" height="100" data-jdenticon-value="John Doe"></svg>