Friday, 15 August 2014

javascript - After loading an AngularJS Controller via AJAX, it does not work -



javascript - After loading an AngularJS Controller via AJAX, it does not work -

how instantiate controller methods may work?

i loading via ajax settingscontroller, 1 time loaded, methods not callable.

what have instantiate code?

i looked @ $compile, doesn't seem work.

standard way of using twitter bootstrap load partial

$("#modal").modal({remote: 'partials/users/settings.html'})

the partial loaded :

%div{'ng-controller' => 'settingscontroller'} = form_tag '', 'ng-submit' => 'update_settings($event)', :method => :post |f|

in settingscontroller :

$scope.update_settings = ($event) -> alert 'hey'

doesn't anything.

okay looks issue here want dynamically load html modal. i'm not sure you're using modal plugin, you're going need this:

<div id="mymodal" ng-include="source"></div>

where source property on $scope:

class="lang-js prettyprint-override">$scope.source = 'test.html';

you hear event $includecontentloaded in directive, , phone call modal function:

class="lang-js prettyprint-override">scope.$on('$includecontentloaded', function () { $('#mymodal').modal(); });

have angular handle pulling downwards partial want include... open modal.

javascript jquery angularjs

No comments:

Post a Comment