ng2-inline-svg
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "ng2-inline-svg", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Angular 2 directive for inserting an SVG inline within an element.", | ||
@@ -15,3 +15,5 @@ "repository": { | ||
"src/*", | ||
"dist/*" | ||
"dist/*", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
@@ -31,3 +33,4 @@ "author": "Eugene Cheung", | ||
"scripts": { | ||
"start": "typings install && tsc --p ./tsconfig.json", | ||
"lint": "tslint src/**/*.ts", | ||
"start": "typings install && npm run lint && tsc --p ./tsconfig.json", | ||
"prepublish": "npm start" | ||
@@ -46,2 +49,3 @@ }, | ||
"rxjs": "5.0.0-beta.6", | ||
"tslint": "^3.14.0", | ||
"typescript": "^1.8.10", | ||
@@ -48,0 +52,0 @@ "typings": "^1.3.2", |
@@ -6,4 +6,6 @@ import { | ||
Input, | ||
OnChanges, | ||
OnInit, | ||
Output | ||
Output, | ||
SimpleChanges | ||
} from '@angular/core'; | ||
@@ -17,4 +19,4 @@ | ||
}) | ||
export default class InlineSVG implements OnInit { | ||
@Input() inlineSVG: string; | ||
export default class InlineSVG implements OnInit, OnChanges { | ||
@Input() private inlineSVG: string; | ||
@Input() replaceContents: boolean = true; | ||
@@ -29,2 +31,12 @@ @Input() cacheSVG: boolean = true; | ||
ngOnInit() { | ||
this._insertSVG(); | ||
} | ||
ngOnChanges(changes: SimpleChanges) { | ||
if (changes['inlineSVG']) { | ||
this._insertSVG(); | ||
} | ||
} | ||
private _insertSVG(): void { | ||
if (!this.inlineSVG) { | ||
@@ -31,0 +43,0 @@ console.error('No URL passed to [inlineSVG]!'); |
@@ -46,3 +46,3 @@ import { Injectable } from '@angular/core'; | ||
private _getAbsoluteUrl(url: string) { | ||
private _getAbsoluteUrl(url: string): string { | ||
const base = document.createElement('BASE') as HTMLBaseElement; | ||
@@ -49,0 +49,0 @@ base.href = url; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13276
256
10