How to make configurable directives via providers/ .config()?

73 views Asked by At

Problem: I want to make a directive that works like this:

svg-icon('company-logo')

I'd also eventually like this to be (jade/html):

svg-icon('company-logo', { height: '3em', width: '3em'})

<svg-icon company-logo height="3em" width="3em"/>

And I want it to return an svg template with the correct logo. I'd also like certain parameters to be configurable like fill color, height, and width. I've done a first try and this is the first snippet:

https://gist.github.com/anonymous/9be8f111591b15fde9be

Right now what's happening other than not working is provider namespace errors and various injector warnings for iconConfig and iconConfigProvider. I'm wondering what I'm doing wrong and how I should approach this problem.

I'm looking at a few blog posts to help:

Creating Configurable Angular Directives with Providers

AngularJS: Factory vs Service vs Provider

and finally, Angular's own docs:

Provider Recipes

I still have no idea how to do this.

0

There are 0 answers