Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-inline-svg

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-inline-svg - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

10

package.json
{
"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;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc