Y
Y
Yuri2016-06-02 13:21:55
Angular
Yuri, 2016-06-02 13:21:55

And how to pass an array to the template used in the angular modal?

Пример, есть некий контроллер. Внутри него есть массив
app.controller('MyCntrl', //тут всякие зависимости function(...) {
     $scope.myArray = [];
     // и есть функция показа модального окна
    $scope.myDlgWindow = function () {
               console.debug($scope.myArray); // тут всё хорошо
               $scope.modalInstance =  $modal.open({
                scope: $scope,
                controller: 'MyCntrl',
               template: 'тут прочий код модального окна...<select ng-options=\"items as item for item in myArray\"' // А тут уже не видим
    }    
});

Why is myArray not visible in the window template? And how to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2016-06-02
@modestguy

Thanks to all. Found a solution. The controller should have been specified without quotes.

controller: MyCntrl,
template:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question