I have some problem getting jQuery which i'm more familiar with to load html with ajax then add this to the view. The template is already loaded then I need to get some data externaly through ajax and put it inside element. But AngularJs runs before all this, I want it to wait until all data is loaded.
Edit: Just to clarify, here is the code, I run the custom.js.
$stateProvider
// Companyresults
.state('companyresults', {
url: "/companyresults.html",
templateUrl: "views/companyresults.html",
data: {pageTitle: 'Dashboard', pageSubTitle: 'statistics & reports'},
controller: "CompanyResultsController",
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load({
name: 'MetronicApp',
insertBefore: '#ng_load_plugins_before', // load the above css files before '#ng_load_plugins_before'
files: [
'../../../assets/admin/layout3/scripts/custom.js',
'js/controllers/CompanyResultsController.js'
]
});
}]
}
});
And..
'use strict';
MetronicApp.controller('CompanyResultsController', function($rootScope, $scope, $http, $timeout) {
$scope.$on('$viewContentLoaded', function() {
// initialize core components
Metronic.initAjax();
});
});