Click here to Skip to main content
15,891,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Page have some files and folders.What i am looking is on selecting any file/folder, its detail get open in new bootstrap tab. On selecting any file i am passing file type in a function (changeType ) in my home controller and catching it in Config

What I have tried:

---- Home Controller ----
HTML
    myApp.controller("HomeController", ['$window', '$rootScope', '$scope', '$state', '$http', , function (.....) {
   $scope.changeType = function (type) {

 if (type == 'Folder') {
                $state.go('Folder');
            }
            else if (viewName == 'File') {
                $state.go('File'); 
            }
}}


---- Index -----
HTML
  <div id="divViews"> 
         <div ui-view="mainModule1"></div>
  <div ui-view="mainModule2"></div>

</div>

---- Route Config ----
HTML
myApp.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
 $stateProvider.state('File', {
     url: '/File',
     views: {
         'mainModule1': {
             url: '',
             templateUrl: '/Views/HtmlDashBoard/File.html',
             controller: 'FileCtrl'
         }
     }      .state('Folder', {
     url: '/Folder',
     views: {
         'mainModule2': {
             url: '',
             templateUrl: '/Views/HtmlDashBoard/Folder.html',
             controller: 'FolderCtrl'
         }
     }

Is there any way to pass views name from home controller to config file since i am making ui-views dynamically ?
Posted
Updated 16-Jul-16 2:24am
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900