Skip to content

Instantly share code, notes, and snippets.

@bhavik07
bhavik07 / angular2-replace.ts
Last active October 26, 2018 19:30
Another approach that can be used to create components that can replace there host elements, based on my SO question(http://stackoverflow.com/questions/34280475/remove-the-host-html-element-selectors-created-by-angular-component). Consider checking this http://plnkr.co/edit/LFKN5doI9Y9wKwPxBbcJ?p=preview
/// <reference path="../node_modules/angular2/core.d.ts" />
/// <reference path="../node_modules/angular2/platform/browser.d.ts" />
/// <reference path="../node_modules/angular2/common.d.ts" />
import { Component, View, Directive, Input, ElementRef, Output, EventEmitter } from 'angular2/core';
import { bootstrap } from 'angular2/platform/browser';
//remove the host of avatar to be rendered as svg
@Directive({