I'm using Angular 1.5.5, Angular-ui-router 0.2.18, angular-meteor-promiser 1.1.0 and meteor 1.3.3
In my application I use the following route definition: (There are many other states) :
function routerConfig($stateProvider, $urlRouterProvider, $locationProvider) { $locationProvider.html5Mode(true); $stateProvider .state('auditionExtExec', { url: '/AuditionExtExecute/:id', templateUrl: 'client/auditions/auditionExtExec.html', resolve: { auditionsubs: function($promiser) { "use strict"; console.log('in resolve'); return $promiser.subscribe('auditions'); }, }, controller: 'AuditionExtExecCtrl', controllerAs: 'vm' })
The controller is :
angular .module('brgo') .controller('AuditionExtExecCtrl', function($state, $stateParams, $scope, $reactive, $promiser, auditionsubs) { var vm = this; $reactive(vm).attach($scope); vm.auditionId = $stateParams.id; vm.subscribe('auditions'); vm.start = false; vm.auditionResults = {}; var currentDate = new Date(); vm.autorun(() => { vm.audition = Auditions.findOne({ _id: vm.auditionId }); }); vm.addNewExecution = function() { vm.auditionResults.auditions = angular.copy(vm.audition.auditions); AuditionExecs.insert(vm.auditionResults); }; vm.startaudition = function() { vm.start = true; }; });
The purpose of this page is to display the contact of the record from audition
MongoDb table and write results to AuditionExec
MongoDb table
When the application run, everything looks OK. However, when I'm in the auditionExtExec
state and I copy the URL to a new window, the view in the new window is presented twice. When I remove the $promiser
from the resolve, it looks like it works fine
删除promiser.subscribe,问题消失
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.