image here
controller html
<ion-content class="padding has-tabs-top" ng-controller="SearchCtrl">
<button class="button button-block button-black-green " tappable ng-click="searchModal.show()" >
Search
</button>
</ion-content>
modal html
<script id="my-modal.html" type="text/ng-template">
<ion-modal-view>
<ion-header-bar class="bar-not-dark">
<button class="button" ng-click="searchModal.hide()">Cancel</button>
<h1 class="title">Search Attendance</h1>
</ion-header-bar>
<ion-content ng-controller="ModalCtrl">
<form class="list" name="searchForm">
<div class="list">
<label class="item item-input item-select">
<div class="input-label">
Month
</div>
<select ng-model="searchForm.month">
<option selected value="">Select Month</option>
<option ng-repeat="monthList in monthData" onload='loadMonth()' ng-if="monthData" value="{{monthList.month}}">
{{monthList.month_name}}
</option>
</select>
</label>
<button type="submit" class="button button-block button-black-green" ng-click="searchAtt(searchForm)">Submit</button>
</form>
</ion-content>
</ion-modal-view>
</script>
controller js
.controller('SearchCtrl', function($scope, $ionicLoading,$ionicModal,$http,$window) {
var start=1;
$scope.monthData = {};
$scope.loadMonth = function () {
var log_user = window.localStorage.getItem("log_user");
$http.get("http://apps.bwdb.gov.bd/swmp/app/monthAPI.php",{params:{log_user:log_user}})
.then(function successCallback(response) {
$scope.monthData = response;
}, function errorCallback(response) {
});
};
$ionicModal.fromTemplateUrl('my-modal.html', {
scope: $scope
}).then(function (modal) {
$scope.searchModal = modal;
$scope.loadMonth();
});
$scope.openModal = function($scope) {
$scope.searchModal.show();
};
$scope.closeModal = function() {
$scope.searchModal.hide();
};
})
How will i pass $scope.loadMonth();
data to modal page. I have attached modal page image. I want to load month list from api in modal for (ionic 1) project. I have attached only month load part code.
Any Tips or any idea.