2014-03-06 3 views
0

지역이있는 메인 애플리케이션으로 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); 
}); 

답변

0

체크 아웃이 응용 프로그램 https://github.com/davidsulc/structuring-backbone-with-requirejs-and-marionette, 당신은 다소 꼭두각시를 알고있는 경우 그것을 이해합니다. 나는 그것이 도움이 될 것이라고 확신합니다. 그것은 주요 마리오네트 응용 프로그램에서 기능 서브 모듈 응용 프로그램을 시작하고 정지시키고 있습니다.

내게 따르면 모듈러 백본 응용 프로그램입니다.

+0

나는이 튜토리얼을 이미 사용했다. :) 정말 좋았어. – user3166101

관련 문제