0

I'm trying to create SPA. So in that case I created one mainApp and in that mainController and inside that I called ngInclude with url's and its working fine. Checkout the code below

<html>
    <head>
        <script type="text/javascript" src="angular.min.js" ></script>
        <script type="text/javascript" src="application_nestedApps.js" ></script>
    </head>
    <body ng-app="mainApp">
        <div ng-controller = "mainController">
            <div ng-include="currentPage"></div>
        </div>
    </body>
</html>

JSCODE :

var mainApp = angular.module('mainApp', []);

mainApp.controller('mainController',['$scope',function($scope){
    $scope.currentPage = "**someURL**";
    // This requestPage function called on page link clicked
    $scope.requestPage = function(requestedURL){
        console.log(requestedURL);
        $scope.currentPage = requestedURL;
    }
}]);

Now the issue is when I'm going to request static resources via URL in that case everything is working fine... but in that case i'm not able to request some angular resource because it not loaded and shows me error...

Anyone please tell me what should I do in that case... I just asked one question on Nested App inside controller in angularJS which is related to that problem...

let me know to change the approach or need some tricks in existing code...

Community
  • 1
  • 1
Ashish Dadhich
  • 4,737
  • 4
  • 17
  • 25
  • Y not use ng-route or ui-route ?? – raj Oct 26 '15 at 08:38
  • ng-route or ui-route will recover that issues ? The reason not using ng-route module because in that case I need to define template and my page contains different layouts on each page... I'm trying to achieve SPA in Liferay... this is the best way i found till now.. so I'm used ng-include instead of ng-route – Ashish Dadhich Oct 26 '15 at 08:48
  • I don't think that's and issue.. Use ui route with nested views..read about it – raj Oct 26 '15 at 08:52
  • I tried, in case of two route(two portlets) on one page, the second one is active and first one not working properly... that means URL conflict in that case. – Ashish Dadhich Oct 26 '15 at 14:08

0 Answers0