Discussions

Ask a Question
Back to All

How to Load Partial View first before Javascript

Hi,

I'm trying to integrate Angular with our existing application that have several jquery scripts on it.

What I wanted to do is load the Partial View first before it execute the javascript from the Lazy Loading.

(function () {
var app = angular.module("app");
app.config(['$routeProvider', '$controllerProvider',
function ($routeProvider, $controllerProvider) {
app.registerCtrl = $controllerProvider.register;
$routeProvider
.when('/', {
templateUrl: "welcome.html",
resolve: {
lazy: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load([{
name: 'app',
files: ['/js/Welcome.js']
}]);
}]
}
})
.when('/two', { templateUrl: "views/page2.html" })
.when('/three', { templateUrl: "views/page1.html" }).otherwise({ redirectTo: '/' })
}]);
})();

I'm not sure on how to do this.

Many thanks