My issue involves binding an ng-model
to an input field. Despite this, the value of the variable it is connected to does not update outside of the specific div
where the directive is defined:
<div input-field
ng-if="startTypes.selected.value == 'LocalDate' || startTypes.selected.value == 'LocalDateTime'">
<input id="date" type="text" ng-model="date" input-date>
<label for="date">Date</label>
Date within scope: {{date}}
</div>
Date outside of scope: {{date}}
Each time a new date is selected, only the inner date
is updated. The outer one retains its previous value (which may be either undefined
or not depending on whether it was declared in the controller).
I am utilizing angular-materialize, but I am uncertain if this is causing the problem as it is specifically designed for Angular integration with the CSS framework materializecss.
Here is the component I am employing.
Edit:
Attempted declaring date
in the controller using $scope.date = new Date()
. This indeed loads the current date in the date picker. However, upon selecting a date and changing the model, the update remains localized (inner scope) while the outer scope retains the old value.