Within my code, I have the following:
var b = 1
var a = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'enteModal.html',
controller: 'enteCtrl',
resolve: {
obj: {"id" : id, "description" : "blabla"},
id: eval(b),
}
});
Surprisingly, this code works perfectly fine, but I'm puzzled as to why. I've gone through the documentation on resolve, which states that it should be a map with keys being either Strings or functions.
The use of eval(id) and {...} seems unconventional since they represent an integer and an object respectively, rather than a factory function. From what I understand, Resolve utilizes angular.injector().invoke(), which typically throws an error when working with objects or integers directly.
Despite these concerns, the controller is able to successfully resolve both obj and id. How is it possible for this to work with an object or integer? Is the documentation incorrect, or does uibmodal's resolve function differ from the typical route resolve?