I have created a component with selector 'app-circle'. The HTML of the component contains an SVG for a circle.
What I want is - to use multiple 'app-circle' in my main HTML to draw multiple circles with different attributes (say, color). But I cannot seem to be able to do this. Basically, my intention was to re-use 'app-circle' as multiple objects.
(Please forgive me for being naive; I am new to angular & web development and my experience is mainly in C#, which might be the reason for me to find difficulty in wrapping around angular/web concepts and way of working)
Here is the code: -
main.html
<div class="diagram-wrapper">
<app-circle></app-circle>
<app-circle></app-circle>
</div>
circle.component.html
<svg class="range" height="100" width="100">
<circle class="circle" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
circle.component.ts
import { Component, OnInit, AfterViewInit } from '@angular/core';
@Component({
selector: 'app-circle',
templateUrl: './circle.component.html',
styleUrls: ['./circle.component.scss']
})
export class CircleComponent implements OnInit, AfterViewInit {
constructor() { }
ngOnInit() { }
ngAfterViewInit() {
// Circle logic (fill colors, etc.)
}
@Input()in order to customize your angular components. If you don't use@Input()all the instances will look the same