如何在angularjs中嵌套状态?
嗨,我正在开发Angularjs应用程序。我对Angularjs是新手。我在UI状态嵌套方面面临一些问题。我的要求是开发忘记密码页面。流程如下所示如何在angularjs中嵌套状态?,angularjs,angular-ui-router,Angularjs,Angular Ui Router,嗨,我正在开发Angularjs应用程序。我对Angularjs是新手。我在UI状态嵌套方面面临一些问题。我的要求是开发忘记密码页面。流程如下所示 ForGotPassword Step 1: MobileNumber DOB Submit->If successful then Step 2: OTP Verify->If successful then Step 3: New Password
ForGotPassword
Step 1: MobileNumber
DOB
Submit->If successful then
Step 2: OTP
Verify->If successful then
Step 3: New Password
Confirm Password
Submit.
对于以上三个步骤,我想将各自的页面插入
class="container">
<div ui-view></div>
</div>
这是我放弃的密码控制器
var app = angular.module('RoslpApp', ['pascalprecht.translate', 'ui.router']);
app.config(function ($stateProvider, $urlRouterProvider, $urlRouterProvider, $translateProvider, $translatePartialLoaderProvider) {
$stateProvider.state('ForgotPassword', {
url: '/ForgotPassword',
templateUrl: 'ForgotPassword/ForgotPassword.html',
controller: 'ForgotPassword'
});
});
(function () {
angular.module('RoslpApp').controller('ForgotPassword', ['$rootScope', '$translatePartialLoader', '$translate', function ($rootScope, $translatePartialLoader, $translate) {
$stateProvider
.state('ResetPassword', {
url: '/ResetPassword',
templateUrl: 'ForgotPassword/ResetPassword.html',
controller: 'ResetPassword'
});
$stateProvider
.state('OTPVerification', {
url: '/OTPVerification',
templateUrl: 'ForgotPassword/OTPVerification.html',
controller: 'OTPVerification'
});
$stateProvider
.state('ChangePassword', {
url: '/ChangePassword',
templateUrl: 'ForgotPassword/ChangePassword.html',
controller: 'ChangePassword'
});
}]);
})();
Forgotpassword.html
<div class="container">
<div ui-view></div>
</div>
我还有ResetPassword.html、OTPVerification.html、ChangePassword.html以及相应的文本框。我不确定我做得是否正确?我可以在这里得到一些帮助吗。任何帮助都将不胜感激。谢谢。有关使用angular ui路由器实现嵌套状态和视图的信息,请参阅此:
有关使用角度ui路由器实现嵌套状态和视图的信息,请参阅:
非常感谢。每当我单击忘记密码时,我都想在其中插入ResetPassword.html。我可以知道如何实现这一点吗?您必须将子状态名称作为parent.childStateName.state('ForgotPassword.ResetPassword'这样我应该使用吗?谢谢。在第一行angular.module('RoslpApp')中,我应该注入['ui.router']?我无法注入视图。请在此处找到我的Plunk。我可以在此处获得一些帮助吗?提前谢谢。谢谢。每当我单击忘记密码时,我都要注入ResetPassword.html。我可以知道如何实现此目的吗?您必须将子状态名称指定为parent.childStateName.state('ForgotPassword.ResetPassword'像这样我应该使用对吗?谢谢。在第一行angular.module('RoslpApp')中我应该注入['ui.router']?我无法注入视图。请在这里找到我的插件。我可以在这里得到一些帮助吗?提前谢谢
(function () {
angular.module('RoslpApp').controller('ForgotPassword', ['$rootScope', '$translatePartialLoader', '$translate', function ($rootScope, $translatePartialLoader, $translate) {
$stateProvider
.state('ForgotPassword.ResetPassword', {
url: '/ResetPassword',
templateUrl: 'ForgotPassword/ResetPassword.html',
controller: 'ResetPassword'
});
$stateProvider
.state('ForgotPassword.OTPVerification', {
url: '/OTPVerification',
templateUrl: 'ForgotPassword/OTPVerification.html',
controller: 'OTPVerification'
});
$stateProvider
.state('ForgotPassword.ChangePassword', {
url: '/ChangePassword',
templateUrl: 'ForgotPassword/ChangePassword.html',
controller: 'ChangePassword'
});
}]);
})();