Posts

Showing posts from October, 2014

AngularJS - Triggering code whenever ng-view updates

//Create the module var app = angular.module('someapp', ['ngRoute']); //Config the routes app.config(configRoutes); function configRoutes($routeProvider) { $routeProvider .when('/', { templateUrl: '/angular/viewtemplates/admin/index.html', controller: 'AdminController' }) .when('/categories', { templateUrl: 'angular/viewtemplates/admin/categories/index.html', controller: 'CategoryIndexController' }) } //Make sure we are notified whenever the ng-view is updated app.run(function($rootScope) { $rootScope.$on('$viewContentLoaded', function() { $('table[data-toggle="table"]').bootstrapTable(); }); });