我正在使用Angular ui.router
或路由我的观点。但是在这里我需要使用Angular.js设置嵌套视图和控制器。我在下面提供我的代码。
的index.html:
<!DOCTYPE html>
<html lang="en" class="no-js" ng-app="ikomplianzNABH">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>ikomplianz</title>
<script src="../jsLib/js/angularjs.js" type="text/javascript"></script>
<script src="../jsLib/js/angularuirouter.js" type="text/javascript"></script>
<script src="View/js/NABHRoute.js" type="text/javascript"></script>
<script src="View/js/NABHController.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
</head>
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top" onLoad="goforit()">
<div class="loader"></div>
<div ui-view></div>
</body>
</html>
route.js:
var compliance=angular.module('ikomplianzNABH',['ui.router']);
compliance.run(function($rootScope, $state) {
$rootScope.$state = $state;
});
compliance.config(function($stateProvider, $urlRouterProvider,$locationProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('/', { /*....This state defines All type of user login...*/
url: '/',
templateUrl: 'View/NABH.html',
controller: 'NABHController'
})
});
此处当最初的网址正在运行时,NABH.html
会附加在index.html's
<div ui-view></div>
部分内。 NABH.html
如下所示。
NABH.html:
<div id="nabhinitiate">
//here need to another html part and add new controller or it.
</div>
<div class="clecklist">
<button type="button">Click Me</button>
</div>
我需要用户点击Click Me
按钮时,HTML
<div id="nabhinitiate"></div>
NABH.html
内的<div class="clecklist"><button type="button">Click Me</button></div>
页面将会隐藏<h1>Hello child page </h1>
。
nabhinitiate.html:
fileName=names1[i]+".txt" # Generating file name as fieldname.txt
#data1.groupby(names1[i]).agg(F.collect_set("name")).rdd.saveAsTextFile(names1[i]+'.txt')
data.groupby(names1[i]).agg(F.collect_set("name")).rdd.saveAsTextFile(fileName)
这里我也需要一个子视图来控制这个视图,并且在我需要路由它的同一个URL中。 Here is the plunkr code。