I'm trying to implement angular UI modal and trying to set few default values before create person screen is opened. Say a new person object like below:
var person = {};
person.name = 'default';
In this function
modalCtrl.open = function(size) {
var person = {};
person.name = 'default';
console.log('person-->' + person);
console.log('person.name-->' + person.name);
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
scope: $scope,
resolve: {
person: function() {
return person;
}
}
});
I can do the same thing in update flow if the object is passed by a called.
My assumption is that I should be able to create a new object and resolve it to display few default values on create screen. Does anyone know why I can't do it? Here is the plunker: