到目前为止我尝试了什么
app.js
var myapp = angular.module('myapp',['ui.router']);
itaasContentApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/404');
$stateProvider.state('parent', {
url:'/parent',
templateUrl :'partials/parent.html',
controller:'parentCtrl'
})
.state('parent.child',{
url:'/child',
templateUrl :'partials/child.html',
controller :'childCtrl'
});
parentCtrl
app.controller('parentCtrl', function($scope,$state) {
var init=function()
{
//it will initialize the controller
}
init();
//I am calling child state
$state.go("parent.child");
});
childCtrl
app.controller('childCtrl', function($scope,$state) {
init=function()
{
//it will initialize the controller <html data-ng-init='init()'>
}
//calling init
init();
$scope.goBack=function()//I will call this method from view
{
$state.go('^');
}
});
问题