newEvent categories selection implemented, and image by url (temporalment)

This commit is contained in:
arnaucode
2017-02-24 00:33:16 +01:00
parent e102427098
commit 8b1e678202
2 changed files with 39 additions and 12 deletions

View File

@@ -3,8 +3,10 @@ angular.module('app.newEvent', ['pascalprecht.translate', 'ui-leaflet'])
.controller('NewEventCtrl', function($scope, $http, $ionicModal, $timeout, .controller('NewEventCtrl', function($scope, $http, $ionicModal, $timeout,
$ionicLoading, $filter, leafletData, leafletBoundsHelpers) { $ionicLoading, $filter, leafletData, leafletBoundsHelpers) {
//initialization
$scope.event={}; $scope.event={};
$scope.event.categories=[{name: "prova"}]; $scope.event.categories=[];
$scope.event.location={ $scope.event.location={
direction: "", direction: "",
geo: { geo: {
@@ -13,6 +15,32 @@ angular.module('app.newEvent', ['pascalprecht.translate', 'ui-leaflet'])
name: "" name: ""
} }
}; };
//get list of categories
$scope.categories;
$http.get(urlapi + 'categoriesList')
.then(function(data){
$scope.categories=data.data;
console.log($scope.categories);
}, function(data){
console.log('data error');
console.log(data);
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
});
$scope.categorySelected = function(){
$scope.event.categories=[];
for(var i=0; i<$scope.categories.length; i++)
{
if($scope.categories[i].selected)
{
$scope.event.categories.push($scope.categories[i]);
}
}
console.log($scope.event.categories);
};
$scope.postEvent = function(){ $scope.postEvent = function(){
$http({ $http({
url: urlapi + 'events', url: urlapi + 'events',

View File

@@ -15,17 +15,16 @@
<span class="input-label">{{'Hour' | translate}}</span> <span class="input-label">{{'Hour' | translate}}</span>
<input ng-model="event.date" type="time" placeholder=""> <input ng-model="event.date" type="time" placeholder="">
</label> </label>
<!--<label class="item item-input item-select"> <label class="item item-input">
<div class="input-label"> <input type="text" ng-model="event.img" placeholder="img">
Categories </label>
</div> <ion-list>
<select> Categories:
<option>Xerrada</option> <ion-checkbox ng-model="category.selected" ng-repeat="category in categories"
<option>Esport</option> ng-click="categorySelected()">
<option>Debat</option> {{category.name}}
<option>Taller</option> </ion-checkbox>
</select> </ion-list>
</label>-->
<label class="item item-input"> <label class="item item-input">
<input type="text" ng-model="event.location.direction" placeholder="Direction"> <input type="text" ng-model="event.location.direction" placeholder="Direction">
</label> </label>