angularjs - How do I integrate an existing modal framework written in JQuery in angular? -


we have purchased css whole bunch of our ui. includes things tabs, wizards , modals. template uses jquery rendering. have read angular discourages jquery , should try in angular. unfortunately 3rd party tool , our team sold on it.

we have number of screens display grid. page includes 1 'add new' button , 'edit' button each row displayed on grid. when user clicks 'add new' button need show modal allows him capture new entity (whatever is). when user clicks 'edit' opens similar modal , populates fields.

the modal needs opened jquery calls plugin. able use jquery angular in controllers can open theme's modal. i jquery that. rest stick angular way far possible.

first of all, not forbidden use jquery angularjs. highly recommended use possible because lose of it's data-bind , events power don't need code.

when using 3rd-party, have 3 choices.

  1. you can use bridge exists 1 bootstrap: (http://angular-ui.github.io/bootstrap/)

  2. you can build bridge need between 3rd-party plugin , angularjs using directives, watch, events , making sure call scope.$apply() appropriate. example:

    <div data-modal title="header">content</div>

    can automatically create modal calling $(element).modal() , apply template html if want simplify.

  3. you can stop giving damn , call scope.$apply() when need when using 3rd-party. not best solution , bad long term, if don't have time write bridge or never reuse it, it's not end of world.

the third option there, don't use unless have no choice. developping simple directive , adding features best way go unless solid has been coded. , when used it, it's quite fankly easy.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -