As per the instructions found on this blog, in order to create inner components within an SVG using Angular 2, we need to utilize an [attribute] selector:
// Within svgmap.component.ts file: component declaration
@Component({
selector: '[svgmap]',
templateUrl: 'app/svg/map/svgmap.template.html'
})
In my current setup, the SVGMapComponent
is implemented in various parent component templates like so:
<svg [attr.class]="mapClass[0]" svgmap="1"></svg>
<svg [attr.class]="mapClass[1]" svgmap="2"></svg>
<svg [attr.class]="mapClass[2]" svgmap="3"></svg>
While this functions well up to this point, I now find myself needing to access the value passed as the svgmap attribute (e.g. "1,2,3" in the aforementioned example) within the code of svgmap.component.ts
, but I am unsure if this is achievable or how to go about it.
If extraction is possible, what syntax should be utilized within my TypeScript child component (i.e. svgmap.component.ts
)?
If extraction is not feasible, what limitations are preventing it? Is there a workaround available?
P.S.: After exploring resources like this post, while insightful in certain scenarios, it does not directly address the specific situation described above.