1

I've created a Directive and inside I use some Css classes and it would be nice if you can config the Css classes on Application start in the config section. I thougt a provider would be the right solution. But I have no clue how to create a provider with TypeScript Classdefinition and how to initialize it.

I've searched the web but found no working solution so far.

1
  • Typescript is a superset of Javascript, so if in doubt, just write Javascript as you find it in AngujarJS' documentation about providers… Commented Jun 27, 2015 at 13:23

1 Answer 1

1

This is a little rough but should give you a general idea on how to do it. Providers in general are kind of pain.

class CommonServiceProvider implements ng.IServiceProvider {
    config = {
        path:"/test"
    };
    $get = () => {
        return {
            config: this.config
        };
    };
}

angular.module("app).provider("commonConfig", () =>
    new CommonServiceProvider()
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.