ashwani pathak ashwani pathak - 5 months ago 8
AngularJS Question

AngularJs my View is not loading

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {

if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);

}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})

.config(function($stateProvider, $urlRouterProvider) {


$stateProvider


.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})



.state('notePadHome', {
url: '/notePadHome',
views: {
'notePadHome': {
templateUrl: 'templates/notePadHome.html',
controller: 'DashCtrl'
}
}
})


$urlRouterProvider.otherwise('/notePadHome');

});

Answer

In tabs.html you need to apply at ion-nav-view element the name="tab".

And then in your app.js try this:

.state('notePadHome', {
url: '/notePadHome',
views: {
  'tab': {
    templateUrl: 'templates/notePadHome.html',
    controller: 'DashCtrl'
  }
}
})

If you want remove the tab from app.js, remember to remove it also in your home view route, like this:

.state('notePadHome', {
 url: '/notePadHome',
 templateUrl: 'templates/notePadHome.html',
 controller: 'DashCtrl'

})
Comments