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

Setting multiple templates #97

Open
abhi901abhi opened this issue Nov 8, 2015 · 2 comments
Open

Setting multiple templates #97

abhi901abhi opened this issue Nov 8, 2015 · 2 comments

Comments

@abhi901abhi
Copy link

Hi,

Can we set multiple templates for block UI. For examaple , I have two divs, For one dive I will use Round Loading Symbol and for other Div I will use Bar Loading symbol. ''Can we do like this?"

@kyleguate
Copy link

Hey abhi901abhi,

I had a similar need. Basically I wanted to have a default, success, error, info, and warning templates.

While I think it would be ideal to have a way to load up multiple templates, I used the following workaround:

Define a custom template in the blockUIConfig:

blockUIConfig.template =
            '<div class="block-ui-overlay"></div>' +
            '<div class="block-ui-message-container" aria-live="assertive" aria-atomic="true">' +
            '<div class="block-ui-message data-ng-binding" data-ng-class="state.cssClasses">{{ state.message }}</div></div></div>"';`

I copied the default template and added the 'state.cssClasses' in the data-ng-class. Then to pass the css class in you specify it as a custom property on the start method:

.start({
  message: 'Save Successful',
  cssClasses: ['success', 'other-custom-class']
});

For your use case you could pass in a property called 'icon' and then add a placeholder for it in your custom template.

Does that make sense?

@RODOBTA
Copy link

RODOBTA commented Nov 28, 2016

Is there any way to modify the path of the blockUIConfig.templateUrl,
I want to do it with dynamic templates and send that value through blockUI.start ({templateUrl: 'path'});
So far I get the value of the route but I have not been able to make it load the template.

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

3 participants