我在filea.controller.js中有变量:var x; 我想在fileb.controller.js中使用var x
filea:
angular.module('track.filea.controllers', ['track','ionic-ajax-interceptor'])
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('schedule', {
url : '/filea',
cache : false,
templateUrl : 'views/filea/filea.html',
controller : 'fileactrl'
}) // end of state
}) // end of config
.controller('fileactrl', function($scope,$state,appServices) {
var x=0;
});
fileb:
angular.module('track.fileb.controllers', ['track','ionic-ajax-interceptor'])
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('schedule', {
url : '/fileb',
cache : false,
templateUrl : 'views/fileb/fileb.html',
controller : 'filebctrl'
}) // end of state
}) // end of config
.controller('filebctrl', function($scope,$state,appServices) {
console.log(x)
});
控制器只能在其视图中正常工作