I have got a page with with dynamic dialog and would like to add some content into it from angularJS controller.
The html code is:
<ons-template id="calendar.html">
<ons-dialog style="height: 250px;" var="naviDialog" cancelable ng-controller="datesController">
<ons-navigator var="myNav">
<div id="sevenDays" style="text-align: center"></div>
</ons-navigator>
</ons-dialog>
</ons-template>
And controller looks like:
module.controller('datesController', function($scope) {
$scope.addDates = function () {
for (var i = 0; i <= 8; i++) {
var date = new Date();
date.setDate(date.getDate() + i);
$("#sevenDays").append("<div id='day" + i + "'>" + ("0" + date.getDate()).slice(-2) + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + date.getFullYear() + "</div>");
}
$("#day0").replaceWith("<div id='day0' class='current'>today</div>");
$("#day1").replaceWith("<div id='day1'>tomorrow</div>");
};
$scope.addDates();
});
But jQuery doesn't append content into #datesController
Would anybody help me with this issue?
<div id="sevenDays" style="text-align: center"></div>, run ang-repeatin it, and update the model in thecontroller.