ngBootbox icon indicating copy to clipboard operation
ngBootbox copied to clipboard

dialog controller not working

Open shangdiyisi opened this issue 10 years ago • 9 comments

Dialog controller not working

shangdiyisi avatar Dec 15 '15 03:12 shangdiyisi

Main page defined app, modal dialog defined controller. Main page' controller is ok, but modal dialog's controller is not working.

shangdiyisi avatar Dec 16 '15 01:12 shangdiyisi

Dialog's directive is ok, but modal dialog's controller is not working.

shangdiyisi avatar Dec 16 '15 02:12 shangdiyisi

@eriktufvesson @vlapo

shangdiyisi avatar Dec 16 '15 02:12 shangdiyisi

Hi, do you have any console output?

This example works for me:

script.js

var app = angular.module('myApp', ['ngBootbox']);

app.controller('MyCtrl', function($scope, $rootScope){
});

app.controller('DialogCtrl', function($scope){
    $scope.testVar = 'Variable :)';
});

index.html

<a title="Edit" href=""
      ng-bootbox-custom-dialog
      ng-bootbox-custom-dialog-template="./template.html">Update This</a>

template.html

<form ng-controller="DialogCtrl">
    {{testVar}}
</form>

vlapo avatar Dec 16 '15 08:12 vlapo

@vlapo

app.controller('DialogCtrl', function($scope){
    $scope.testVar = 'Variable :)';
});

This controller dosnt work when I defined in template.html

shangdiyisi avatar Dec 16 '15 09:12 shangdiyisi

Define in template.html ??? Like this ?

<script type="text/javasctript">
app.controller('DialogCtrl', function($scope){
    $scope.testVar = 'Variable :)';
});
</script>
<form ng-controller="DialogCtrl">
    {{testVar}}
</form>

vlapo avatar Dec 16 '15 09:12 vlapo

Argument 'outsideUrlSwitchController' is not a function, got undefined

shangdiyisi avatar Dec 16 '15 09:12 shangdiyisi

@vlapo yes

shangdiyisi avatar Dec 16 '15 09:12 shangdiyisi

This is no issue of ngBootbox. You just dont know hot to work with javascript or angular.

Javascript in templates html is not resolved, and app variable is undefined too. Define it as in my example (one js file included to index.html).

vlapo avatar Dec 16 '15 09:12 vlapo