ui-codemirror icon indicating copy to clipboard operation
ui-codemirror copied to clipboard

codemirror doesn't work inside ng-show

Open mwienk opened this issue 11 years ago • 3 comments

It doesn't work when it's loaded inside ng-show. However, it does work with ng-if.

mwienk avatar Mar 06 '14 20:03 mwienk

It also doesn't work inside an ng-repeat, and neither inside a directive.

I can't find a way to have multiple instances like this:

    <div ng-repeat="tab in tabs">
        <textarea ui-codemirror="tab.options" ng-model="tab.content"></textarea>
    </div>

I also tried wrapping it inside a directive like this:

    <div ng-repeat="tab in tabs">
        <div code-editor="tab"></div>
    </div>
app.directive('codeEditor', function() {
    return {
        restrict: "A",
        template: '<textarea ui-codemirror="tab.options" ng-model="tab.content"></textarea>',
        scope: {
            tab: '=codeEditor'
        },

        link: function($scope, $element, $attrs) {

            $scope.$watch('tab.content', function(content) {

                $scope.tab.dirty = (content != $scope.tab.original);
            });
        }
    };
});

any ideas why is not working? In the meanitme I probably going to try to build my own codemirror directive.

mcampa avatar Mar 06 '14 21:03 mcampa

I'm running into the same issue when the directive is within ng-if

monokrome avatar Mar 09 '14 02:03 monokrome

Possible duplicate of #24

monokrome avatar Mar 09 '14 02:03 monokrome