Search code examples
asp.netangularjsangularjs-ng-include

angularjs - nginclude - asp.net mvc - loading all scripts again


I have been using ng-include in my asp.net mvc application and have had no issues with the same. I happened to check the source code and found that nginclude is also loading all the scripts (in master page) again. Please check the attached snapshot of the source code. Is that an expected behavior? Am I doing anything wrong about it? This is how I normally use the include:

<div ng-include="'/Home/PDFReport/'"></div>

enter image description here

Thanks!


Solution

  • You should return at your controller the View PDFReport as PartialView, then It will avoid to load the entire Layout and whole bunch of scripts.

    At your Controller:

    public ActionResult PDFReport()
    {
      /*Other stuff comes here*/
      return PatialView();
    }