Comments (6)
i also try to use opened promise... but when it's fired, dialog is not ready...
dlg = $dialogs.create('views/dialogs/rest_newbonuses.html', 'RestNewbonusesCtrl', {}, {
key : false,
back : 'static'
});
dlg.opened.then(function() {
$('#select-model').selectize({
create : true,
sortField : 'text'
});
console.log('coucou');
});
nb : when i call selectize on the console when dialog is on the screen, it's working...
from angular-dialog-service.
The returned modal object that uses "opened" is a function of the Angular-UI-Bootstrap project, $dialogs.create only returns the created $modalInstance. I think if "opened" doesn't work it may be a question for the Angular-UI team. I'll take a look at it when I have time, but I have a feeling its more about the way your application is constructed. $viewContentLoaded is an event attached to ng-view, the modal will not respond to this event in the dialog's controller.
There are two things that I can think of right now that may be the problem.
- You have a race situation. The modal doesn't render before your init code gets executed. Try using a $timeout around your init function to see if that is the culprit - I'm not saying that this is a solution to the problem I'm suggesting this might help to narrow done whats actually happening.
- Your selectize script happens outside the scope of Angular and inside the scope of jQuery. You need to $apply changes made via jQuery to Angular's scope.
from angular-dialog-service.
Just read your little note about using selectize on the console when the dialog is on screen, to me this says you have the "race" situation. Your selectize code is executing prior to the modal being rendered.
from angular-dialog-service.
I ran a test using the "modal.opened.then" - the supplied function to "then" executes prior to the modal being rendered.
The Angular-UI docs state that the "opened" promise "is resolved when a modal gets opened after downloading content's template and resolving all variables" - this happens before the modal is rendered to the page.
I suggest trying to use the $timeout service to delay the execution of your init function.
from angular-dialog-service.
Any luck?
from angular-dialog-service.
$timeout(function(){init();});
and all is ok.... :-)
Thanks for your help
NB : i try to $apply but it does nothing.
from angular-dialog-service.
Related Issues (20)
- Upgrade to angular-bootstrap ~1.0? HOT 6
- Call dialog from a bootstrap modal dialog - Position HOT 7
- the translation for chinese does not work. HOT 1
- Look into using the multi-transclusion feature in angular 1.5
- How to add buttons to error dialog?
- is it possible to change the url when a modal opens
- Remove bootstrap bower dependency
- More accessibility support HOT 5
- Disabling the X button for the dialogs HOT 2
- Error: $injector:modulerr Module Error HOT 5
- Confirm Dialog Doesn't work with ui.bootstrap v1.3.3 HOT 1
- how can i close dialog from service? HOT 1
- Dialog appearing behind bootstrap modal window. HOT 1
- Angular functions not work on modal HOT 1
- How to add class to modal-dialog?
- Angular bootstrap modal
- Setting default options for all dialogs HOT 1
- Support component param from angular bootstrap dialog HOT 4
- Font Awesome 5
- Options is not fitting in the input size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-dialog-service.