3

In AngularJS I see the way to fill an input is using a model:

<input type="text" ng-model="date">

And the model's default value is filled from JavaScript like this:

function Ctrl($scope) {
    $scope.date = "2013-07-03";
}

Since in my case the default value of the model changes this means my controller would have to be in a dynamic JavaScript file but I would like to keep all JavaScript files static. How can I fill the model in the controller from the html itself? I've tried the following but it doesn't work:

<input type="text" ng-model="date" value="2013-07-03">
Bastien Caudan
  • 4,482
  • 1
  • 17
  • 29
solarc
  • 5,638
  • 2
  • 40
  • 51

0 Answers0