onsenui/bug1630/js/core.js
// controller's name is registered in Application.ts and specified from ng-controller attribute in index.html
controller's name is registered in Application.ts and specified from ng-controller attribute in index.html
controller ' s name is registered in Application . ts and specified from ng - controller attribute in index . html
function MyModelController($scope, $location, onsenuiStorage) {
            this.$scope = $scope;
            this.$location = $location;
            this.onsenuiStorage = onsenuiStorage;
            MyModelController.ID++;
            this.onsOnsenUINavigator = $scope.onsOnsenUINavigator;
            onsenuiCore.Navigator.onsOnsenUINavigator = $scope.onsOnsenUINavigator;
            this.scope = $scope;
            this.storage = onsenuiStorage;
            var currentPage = null;
            var isList = false;
            if (!onsenuiCore.Navigator.hasPages()) {
                isList = true;
            }
            else {
                currentPage = onsenuiCore.Navigator.getCurrentPage();
                if (currentPage == null) {
                    var pages = onsenuiCore.Navigator.onsOnsenUINavigator.pages;
                    console.error("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor() - undefined current page pages=", pages);
                    for (var i = 0; i < pages.length; i++) {
                        console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor() - page[" + i + "] " + pages[i].name);
                    }
                    return;
                }
                if (currentPage.name == 'new-mymodel.html' || currentPage.name == 'view-mymodel.html' || currentPage.name == 'edit-mymodel.html') {
                    isList = false;
                }
                else {
                    isList = true;
                }
            }
            if (currentPage != null) {
                console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): page: " + currentPage.name);
            }
            else {
                console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): page: initialization...");
            }
            if (isList) {
                if (currentPage != null && currentPage.data != null && currentPage.data.selectedItems != null) {
                    console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): selectedItems3 = " + currentPage.data.selectedItems.length);
                    this.scope.items = currentPage.data.selectedItems;
                }
                else {
                    this.scope.items = this.storage.getMyModelItems();
                }
            }
            else {
                if ($scope.onsOnsenUINavigator != null && currentPage != null) {
                    if (currentPage.data != null && currentPage.data.selectedParam != null) {
                        console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): selected item", currentPage.data.selectedParam);
                        this.scope.mymodel = onsenuiCore.MyModelItem.copy(currentPage.data.selectedParam);
                        this.scope.initialMyModel = onsenuiCore.MyModelItem.copy(this.scope.mymodel);
                    }
                    else {
                        console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): " + currentPage.name + " create new item");
                        this.scope.mymodel = new onsenuiCore.MyModelItem();
                        this.scope.initialMyModel = new onsenuiCore.MyModelItem();
                    }
                }
                else {
                    console.warn("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): undefined navigator");
                    this.scope.mymodel = new onsenuiCore.MyModelItem();
                    this.scope.initialMyModel = new onsenuiCore.MyModelItem();
                }
            }
        }
function MyModelController ( $scope , $location , onsenuiStorage ) { this . $scope = $scope ; this . $location = $location ; this . onsenuiStorage = onsenuiStorage ; MyModelController . ID ++ ; this . onsOnsenUINavigator = $scope . onsOnsenUINavigator ; onsenuiCore . Navigator . onsOnsenUINavigator = $scope . onsOnsenUINavigator ; this . scope = $scope ; this . storage = onsenuiStorage ; var currentPage = null ; var isList = false ; if ( ! onsenuiCore . Navigator . hasPages ( ) ) { isList = true ; } else { currentPage = onsenuiCore . Navigator . getCurrentPage ( ) ; if ( currentPage == null ) { var pages = onsenuiCore . Navigator . onsOnsenUINavigator . pages ; console . error ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor() - undefined current page pages=" , pages ) ; for ( var i = 0 ; i < pages . length ; i ++ ) { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor() - page[" + i + "] " + pages [ i ] . name ) ; } return ; } if ( currentPage . name == 'new-mymodel.html' || currentPage . name == 'view-mymodel.html' || currentPage . name == 'edit-mymodel.html' ) { isList = false ; } else { isList = true ; } } if ( currentPage != null ) { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): page: " + currentPage . name ) ; } else { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): page: initialization..." ) ; } if ( isList ) { if ( currentPage != null && currentPage . data != null && currentPage . data . selectedItems != null ) { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): selectedItems3 = " + currentPage . data . selectedItems . length ) ; this . scope . items = currentPage . data . selectedItems ; } else { this . scope . items = this . storage . getMyModelItems ( ) ; } } else { if ( $scope . onsOnsenUINavigator != null && currentPage != null ) { if ( currentPage . data != null && currentPage . data . selectedParam != null ) { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): selected item" , currentPage . data . selectedParam ) ; this . scope . mymodel = onsenuiCore . MyModelItem . copy ( currentPage . data . selectedParam ) ; this . scope . initialMyModel = onsenuiCore . MyModelItem . copy ( this . scope . mymodel ) ; } else { console . log ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): " + currentPage . name + " create new item" ) ; this . scope . mymodel = new onsenuiCore . MyModelItem ( ) ; this . scope . initialMyModel = new onsenuiCore . MyModelItem ( ) ; } } else { console . warn ( "[onsenuilog] MyModelController#" + MyModelController . ID + "::constructor(): undefined navigator" ) ; this . scope . mymodel = new onsenuiCore . MyModelItem ( ) ; this . scope . initialMyModel = new onsenuiCore . MyModelItem ( ) ; } } }
controller's name is registered in Application.ts and specified from ng-controller attribute in index.html
controller ' s name is registered in Application . ts and specified from ng - controller attribute in index . html
////// init attributes // ons onsenui navigator // scope // storage // console.log("[onsenuilog] MyModelController#" + MyModelController.ID + "::constructor(): mymodel index');