지역이있는 메인 애플리케이션으로 webapp를 개발 중입니다. 처음에는 주 영역이 LoginModule로 시작되며 LoginView에는 HTML 템플릿이 포함되어 있습니다. 이제 성공적인 로그인 후에 LoginModule이 뷰를 멈추고 숨기고 일련의 새로운 모듈을 시작하고 렌더링하기를 원합니다. 지금까지 응용 프로그램 영역에서 새로운 모듈을 렌더링 할 수 있지만 LoginView를 중지하고 숨기는 데 실패했습니다. 내가 무엇을 할 수 있을지 ?Backbone Marionette Hiding Modules
MyApp.module("LoginModule", function(LoginModule, MyApp, Backbone, Marionette, $,_){
LoginModule.startWithParent = true;
//Private Data And Functions
//E.g. var privateVar = "private";
//Public Data And Functions
//E.g. LoginModule.publicVar = "public";
LoginModule.view = new LoginView();
//Initializer & Finalizer
LoginModule.addInitializer(function(){
});
LoginModule.addFinalizer(function(){
LoginModule.view = null;
});
//Functions
LoginModule.login = function(email, password){
//Hardcoded Login
var marius = new User({name: "Marius", surname: "Widmann", password: "password", email: "[email protected]"});
if(marius.get('email') === email){
//Start the NavBarView in the header region
MyApp.header.show(new NavBarView());
/*####################*/
//Now here I want to stop the module or lets say hide the LoginView
/*####################*/
}else{
alert('Login failed');
}
}
});
//Module Subscribers
MyApp.module('LoginModule').on('LoginView:login', function(email, password){
this.login(email, password);
});
나는이 튜토리얼을 이미 사용했다. :) 정말 좋았어. – user3166101