I'm in the process of learning AngularJS directives and facing a challenge. Here's the JSFiddle link to an example I'm working on: https://jsfiddle.net/7smor9o4/
In the example, my expectation is for the vm.alsoId
variable to match the value of vm.theId
. While vm.theId
displays the correct value in the template, vm.alsoId
does not.
I need help identifying where I might be going wrong and what steps I can take to achieve my objective effectively.
To give you some context, my end goal is something along the lines of:
function directive(service) {
var vm = this;
vm.entity = null;
init();
function init() {
service.getEntity(vm.theId).then(function (entity) {
vm.entity = entity;
});
}
}