Can we upload data to the calling controller and upload the html file using the solution?
. - , , , .
;
Ui- #
.state('myState', function () {
resolve: {
dataset: function (Service) {
return Service.getData();
}
},
controller: 'Controller'
})
.controller('Controller', function (dataset) {
this.dataset = dataset;
})
, ( ng-controller root ).
ngRoute #
.when('/path', {
resolve: {
dataset: function (Service) {
return Service.getData();
}
},
controller: 'Controller'
})
.controller('Controller', function (dataset) {
this.dataset = dataset;
})
, ui-router.
ngIf
, , .
.controller('outer', function ($timeout) {
this.resolved = false;
this.dataset = [];
$timeout(function () {
this.resolved = true;
this.dataset = [ {}, {} ];
}.bind(this), 1500);
})
.controller('inner', function () {
console.log('I just ran!');
})
<div ng-controller="outer as o">
<div ng-controller="inner as i" ng-if="o.resolved">
{{o.dataset}}
</div>
</div>
jsfiddle