I am currently utilizing Angular version 1.5.5, Angular-ui-router version 0.2.18, angular-meteor-promiser version 1.1.0, and meteor version 1.3.3
Within my application, I have a route defined as follows: (There are various 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 for this route 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 details from the audition
collection in the MongoDb table and save results to the AuditionExec
collection.
While everything appears to be functioning correctly when the application runs, there is an issue where if I navigate to the auditionExtExec
state and copy the URL to a new window, the view in the new window is duplicated. Removing the $promiser
from the resolve seems to resolve this duplication problem.