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 1.4.0 to 1.4.1

2

lib/index.metadata.json

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./inline-svg.directive","export":["InlineSVGDirective"]},{"from":"./inline-svg.module","export":["InlineSVGModule"]}]}
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./inline-svg.directive","export":["InlineSVGDirective"]},{"from":"./inline-svg.module","export":["InlineSVGModule"]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./inline-svg.directive","export":["InlineSVGDirective"]},{"from":"./inline-svg.module","export":["InlineSVGModule"]}]}]

@@ -89,7 +89,7 @@ "use strict";

];
InlineSVGDirective.ctorParameters = [
InlineSVGDirective.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core_1.Inject, args: [platform_browser_1.DOCUMENT,] },] },
{ type: core_1.ElementRef, },
{ type: svg_cache_service_1.SVGCache, },
];
]; };
InlineSVGDirective.propDecorators = {

@@ -96,0 +96,0 @@ 'inlineSVG': [{ type: core_1.Input },],

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"InlineSVGDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[inlineSVG]","providers":[{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}]}],"members":{"inlineSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"replaceContents":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"prepend":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"cacheSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"removeSVGAttributes":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"forceEvalStyles":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"onSVGInserted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onSVGFailed":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null,null],"parameters":[null,{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"_insertSVG":[{"__symbolic":"method"}],"_getAbsoluteUrl":[{"__symbolic":"method"}],"_removeAttributes":[{"__symbolic":"method"}],"_supportSVG":[{"__symbolic":"method"}]}}}}
[{"__symbolic":"module","version":3,"metadata":{"InlineSVGDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[inlineSVG]","providers":[{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}]}],"members":{"inlineSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"replaceContents":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"prepend":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"cacheSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"removeSVGAttributes":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"forceEvalStyles":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"onSVGInserted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onSVGFailed":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null,null],"parameters":[null,{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"_insertSVG":[{"__symbolic":"method"}],"_getAbsoluteUrl":[{"__symbolic":"method"}],"_removeAttributes":[{"__symbolic":"method"}],"_supportSVG":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"InlineSVGDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[inlineSVG]","providers":[{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}]}],"members":{"inlineSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"replaceContents":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"prepend":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"cacheSVG":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"removeSVGAttributes":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"forceEvalStyles":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"onSVGInserted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onSVGFailed":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null,null],"parameters":[null,{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"./svg-cache.service","name":"SVGCache"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"_insertSVG":[{"__symbolic":"method"}],"_getAbsoluteUrl":[{"__symbolic":"method"}],"_removeAttributes":[{"__symbolic":"method"}],"_supportSVG":[{"__symbolic":"method"}]}}}}]

@@ -15,5 +15,5 @@ "use strict";

];
InlineSVGModule.ctorParameters = [];
InlineSVGModule.ctorParameters = function () { return []; };
return InlineSVGModule;
}());
exports.InlineSVGModule = InlineSVGModule;

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"InlineSVGModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/http","name":"HttpModule"}],"exports":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}]}]}]}}}
[{"__symbolic":"module","version":3,"metadata":{"InlineSVGModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/http","name":"HttpModule"}],"exports":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}]}]}]}}},{"__symbolic":"module","version":1,"metadata":{"InlineSVGModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}],"imports":[{"__symbolic":"reference","module":"@angular/http","name":"HttpModule"}],"exports":[{"__symbolic":"reference","module":"./inline-svg.directive","name":"InlineSVGDirective"}]}]}]}}}]

@@ -61,8 +61,8 @@ "use strict";

];
SVGCache.ctorParameters = [
SVGCache.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core_1.Inject, args: [platform_browser_1.DOCUMENT,] },] },
{ type: http_1.Http, },
];
]; };
return SVGCache;
}());
exports.SVGCache = SVGCache;

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"SVGCache":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null],"parameters":[null,{"__symbolic":"reference","module":"@angular/http","name":"Http"}]}],"getSVG":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}}
[{"__symbolic":"module","version":3,"metadata":{"SVGCache":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null],"parameters":[null,{"__symbolic":"reference","module":"@angular/http","name":"Http"}]}],"getSVG":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}},{"__symbolic":"module","version":1,"metadata":{"SVGCache":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@angular/platform-browser","name":"DOCUMENT"}]}],null],"parameters":[null,{"__symbolic":"reference","module":"@angular/http","name":"Http"}]}],"getSVG":[{"__symbolic":"method"}],"_svgElementFromString":[{"__symbolic":"method"}],"_cloneSVG":[{"__symbolic":"method"}]},"statics":{"_cache":{"__symbolic":"error","message":"Variable not initialized","line":13,"character":17},"_inProgressReqs":{"__symbolic":"error","message":"Variable not initialized","line":16,"character":17}}}}}]
{
"name": "ng2-inline-svg",
"version": "1.4.0",
"description": "Angular 2 directive for inserting an SVG inline within an element.",
"version": "1.4.1",
"description": "[DEPRECATED] Renamed to ng-inline-svg.",
"repository": {

@@ -33,23 +33,23 @@ "type": "git",

"lint": "tslint src/**/*.ts",
"start": "npm run lint && ngc",
"prepublish": "npm start"
"build": "npm run lint && ngc",
"prepublish": "npm run build"
},
"peerDependencies": {
"@angular/core": "^2.2.3",
"@angular/http": "^2.2.3",
"@angular/platform-browser": "^2.2.3"
"@angular/core": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1"
},
"devDependencies": {
"@angular/common": "^2.2.3",
"@angular/compiler": "^2.2.3",
"@angular/compiler-cli": "^2.2.3",
"@angular/core": "^2.2.3",
"@angular/http": "^2.2.3",
"@angular/platform-browser": "^2.2.3",
"@angular/platform-server": "^2.2.3",
"rxjs": "5.0.0-beta.12",
"tslint": "^4.0.2",
"typescript": "^2.0.10",
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/compiler-cli": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-server": "^2.3.1",
"rxjs": "5.0.0-rc.4",
"tslint": "^4.1.0",
"typescript": "2.0.10",
"zone.js": "^0.7.2"
}
}
# ng2-inline-svg
[![NPM](https://nodei.co/npm/ng2-inline-svg.png?compact=true)](https://nodei.co/npm/ng2-inline-svg)
**[Demo](https://echeung.me/ng2-inline-svg)**
Angular 2 directive for inserting an SVG inline within an element, allowing for easily styling
with CSS like `fill: currentColor;`.
This is based on [md-icon](https://github.com/angular/material2/tree/master/src/lib/icon),
except this is meant purely for inserting SVG files within an element, without the extra things like
font icons.
## Installation
```shell
npm install --save ng2-inline-svg
```
## Usage
Add `InlineSVGModule` to your list of module imports:
```typescript
import { InlineSVGModule } from 'ng2-inline-svg';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, InlineSVGModule],
bootstrap: [AppComponent]
})
class AppModule {}
```
You can then use the directive in your templates:
```typescript
@Component({
selector: 'app',
template: `
<div class="my-icon" aria-label="My icon" [inlineSVG]="'/img/image.svg'"></div>
`
})
export class AppComponent {
}
```
The SVG file (if found) will be inserted *inside* the element with the `[inlineSVG]` directive.
### Options
#### Inputs
| Property name | Type | Default | Description |
| ------------- | ---- | ------- | ----------- |
| cacheSVG | boolean | `true` | Caches the SVG based on the absolute URL. Cache only persists for the (sessional) lifetime of the page. |
| prepend | boolean | `false` | Inserts before the first child instead of appending, overwrites `replaceContents` |
| replaceContents | boolean | `true` | Replaces the contents of the element with the SVG instead of just appending it to its children. |
| removeSVGAttributes | string[] | | An array of attribute names to remove from all child elements within the SVG. |
| forceEvalStyles | boolean | `false` | Forces embeded style tags' contents to be evaluated (for IE 11).
#### Outputs
| Property name | Callback arguments | Description |
| ------------- | ------------------ | ----------- |
| onSVGInserted | `e: SVGElement` | Emits the `SVGElement` post-insertion. |
| onSVGFailed | `e: any` | Emits when there is some error (e.g. embed SVG not supported, fetch failed, etc.) |
This package has been renamed to [ng-inline-svg](https://github.com/arkon/ng-inline-svg).
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