Currently, I am utilizing angularjs in conjunction with an edit view for a form. My goal is to bind the values that were previously used. Below is the code/HTML snippet that I am working with. In addition to angularjs, I am also implementing typescript following the controller as format.
HTML:
<label ng-repeat="type in Ctrl.Types">
<input type="radio" name="Type" ng-model="Ctrl.Foo.Type" ng-value="type.TypeId" required ng-checked="type.TypeName===Ctrl.Foo.TypeName" />
{{ type.TypeName }} {{ type.TypeName===Ctrl.Foo.TypeName }}
</label>
Typescript JS For getting Foo
Foo:any;
getFoo = (Fooid) => {
this.FooResource.getFooById(Fooid).then((response) => {
this.Foo= response.data;
});
};
While I am able to retrieve all the values successfully and everything appears to be binding properly, I am encountering an issue with the radio buttons. Upon inspecting the HTML element, I notice that the radio button is set to checked="checked". Furthermore, I have confirmed that the expressions in the HTML output as expected. However, the radio button selected state (the dot indicating selection) seems to be inconsistent. There are times when it works as intended, but other times it does not. It appears that the types load and Foo load at different times, which could be a contributing factor.