javascriptangularjsmodalpopup

Load the external js files in angular js modal popup or partial view


I am developing angularJS application and using asp.net mvc as well. I want to open a modal popup from angularJS and then in that popup "View" of mvc is rendered.

The problem I am facing that popup is opening but the js files are not loaded in modal popup. Please help me in this matter of loading the js files in modal popup.

code

    // main angular js
angular.module('PopUpModule', ['ngResource','ngRoute','ui.bootstrap', 'uigridApp'])
    .controller("ModalDemoCtrl", function ($scope, $uibModal, $log, $window) {
    $scope.open = function (size) {
                var modalInstance = $uibModal.open({
                    templateUrl: 'UiGridDemo.html',
                    controller: 'uigridCtrl',
                    size: 'lg',
                    backdrop:'static',
                    windowClass: 'app-modal-window',
                              resolve: {
                        '$uibModalInstance': function () {
                            return function () { return modalInstance; }
                        }
                    }

                });

//modal popup (view of mvc .cshtml file)

         //script
<script src="Script/Script2.js"></script>

       <body>
                //html code goes here
    </body>

problem is i want to load js script(Script2.js) which is having "jquery code" that should get loaded in modal popup which is view(.cshtml) of mvc modal popup is open through angular.but it is does not load(Script2.js).I checked with chrome dev.tools. how to load it help me with this


Solution

  • I got the answer if i load the js file in the parent file from which i am opening modal popup.This file will be available to this modal pop up,