Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IasDialog doesn't allow injection of locals #17

Open
joswhite opened this issue Nov 27, 2017 · 0 comments
Open

IasDialog doesn't allow injection of locals #17

joswhite opened this issue Nov 27, 2017 · 0 comments

Comments

@joswhite
Copy link
Contributor

joswhite commented Nov 27, 2017

To fix this issue, instantiate the new dialog controller using:

let locals = options.locals || {};
locals.$scope = scope;

// Instantiate controller if provided
if (options.controller) {
    this.dialogController = this.$controller(options.controller, locals);
}

// Compile template
this.loadTemplate(options)
    .then((template) => {
    self.compiledDialogElement = self.$compile(template)(locals.$scope);

// Insert element into DOM
element(self.$document.find('body')).append(self.compiledDialogElement);
});

We also need to add an example of using this to the documentation site:

openTemplateUrlCustomDialog = function() {
    IasDialogService
        .open({
            controller: MyDialogController,
            templateUrl: './my-dialog.template.html',
            locals: {foo: 'bar'}
        });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant