如何访问以下页面并通过URL显示div CertificateRegister而不是div EmailRegister,例如www.mysite.com/register#CertificateRegister
eAssinatura.controller('CadastroController', ['$scope', '$route', '$routeParams', '$location', '$http', '$modal', 'blockService', 'notifyService', 'browserService', 'locale',
function ($scope, $route, $routeParams, $location, $http, $modal, blockService, notifyService, browserService, locale) {
//$scope.EmailRegister = true; // setting the div register by e-mail visible when the page loads
//$scope.CertificateRegister = false;
//$scope.showEmailRegister = function () {
// $scope.EmailRegister = true;
// $scope.CertificateRegister = false;
//};
//$scope.showCertificateRegister = function () {
// if (!$scope.LoadedPKI) { //setting PKI when register by certificate is selected
// init();
// }
// $scope.EmailRegister = false;
// $scope.CertificateRegister = true;
//};
$scope.RegisterDisplay = false;
if ($location.path() == '/CertificateRegister') {
$scope.RegisterDisplay = true;
}
}
]);
<div ng-show="RegisterDisplay">
<p>E-mail Register</p>
<a href="#" ng-click="showEmailRegister()">Don' t Have Digital Certificate »</a>
</div>
<div ng-hide="RegisterDisplay">
<p>Certificate Register</p>
<a href="#" ng-click="showCertificateRegister()">Have Digital Certificate »</a>
</div>
答案 0 :(得分:1)
在控制器的顶部,您可以:
$scope.RegisterDisplay = false;
if ($location.path() == '/CertificateRegister') {
$scope.RegisterDisplay = true;
}
在你的HTML中,你应该能够做到这样的事情:
<div id="certregister" ng-show="RegisterDisplay">//This is your CertificateRegister div</div>
<div id="EmailRegister" ng-hide="RegisterDisplay">//This is your EmailRegister div</div>
答案 1 :(得分:0)
我会尝试在你的路线中添加url变量然后让控制器监视它并显示/隐藏div
答案 2 :(得分:0)
如果您使用的是ui-router
,则可以向州添加可选参数,并使用controller
$stateProvider
中的$stateProvider
.state('register', {
url: "/register/:emailRegister",
templateUrl: '.html',
controller: function ($stateParams) {
// If we got here from a url of /register/true
if($stateParams.emailRegister){
$scope.showCertificateRegister();
}
}
})
<{1}}中的@bucket.presigned_post(:key=>key
取出该参数
你可能会这样做:
2015-07-29,5006.009766,5021.439941,4970.279785,5017.439941,118376700,5017.439941
答案 3 :(得分:0)
您是否使用$ routeProvider进行路由?
如果是这样,您可以创建一个参数并在控制器中读取它。
路线:
$routeProvider.when('/register/:showParam?', {...});
控制器:
if ($route.current.params.showParam === 'CertificateRegister') {
$scope.CertificateRegister = true;
}
*我应该添加一些验证(undefined,toLowerCase)