Git Product home page Git Product logo

Comments (6)

sheymann avatar sheymann commented on June 28, 2024 1

Workaround:

function MyModalCtrl($modalInstance){
    var codemirrorInstance = null;

    this.codemirrorOptions = {
      ...
      onLoad: function(cmInstance) {
          codemirrorInstance = cmInstance;
      }
    };

    setTimeout(function() {
        codemirrorInstance .refresh();
    }, 0);
}
angular.module('myModule').controller('MyModalCtrl', MyModalCtrl);

then in the HTML (assuming you use controllerAs):

<ui-codemirror ng-model="MyModalCtrl.model" 
ui-codemirror-opts="MyModalCtrl.codemirrorOptions"></ui-codemirror>

from ui-codemirror.

agibson-fl avatar agibson-fl commented on June 28, 2024 1

We duplicated this problem with this and I believe it is due to conditional visibility on container elements. Here's a plunkr showing this problem without using modals and just using conditional visibility. In our app, we have a conditionally visible area with a codemirror element in it, and then we have a button to expand it into a larger modal. BOTH areas showed this problem. We could fix the area that wasn't using a bootstrap modal by changing the containers with ng-show's and ng-hide's to ng-if's but this leaves the bootstrap problem. The bootstrap modal and our code both have the conditionally hidden elements in common.

For this reason, I don't think it's a bootstrap problem but rather a conditional visibility issue. I almost didn't find this issue because of the naming.

I tried the above workaround suggested by @sheymann, but couldn't get it to work.

from ui-codemirror.

vanto avatar vanto commented on June 28, 2024

The breaking change has apparently been introduced in 0.11.1. With 0.11.0 it still works as expected.

from ui-codemirror.

sheymann avatar sheymann commented on June 28, 2024

It still doesn't work in AngularUI Boostrapt 0.13.0

from ui-codemirror.

sheymann avatar sheymann commented on June 28, 2024

@agibson-fl what is your version of Angular? I've tested on v1.3.16 and Angular-UI v0.13.0.

from ui-codemirror.

agibson-fl avatar agibson-fl commented on June 28, 2024

@sheymann The plunkr I posted is using Angular v1.2.6. But our codebase is using v1.3.13. The ui-bootstrap version is 0.13. The same problem occurs. But again, I think this problem is not one with ui-bootstrap specifically but rather the visibility settings of the elements that contain the ui-codemirror element.

from ui-codemirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.