Keshav Keshav - 22 days ago 5
AngularJS Question

load template url from $http request in state routing

I want to load templateurl from $http call.

$stateProvider
.state('home', {
url: '/',
templateUrl: will be served by $http call from server
});


Please suggest how i will implement this.

Answer

Angular has done it it in most elegant way .If you want to call your backend controller to request a jsp page for templateurl just call $http url like this

.state('inbox', {
        url: '/inbox',
        templateUrl:'jspController/inboxRecord',
        controller : 'inboxController'
    }) 

that url respond with jsp page in my case inboxrecord.jsp that will be rendered.

Comments