[英]use ng-repeat for edit form data
I can't get the edit function working in angularJS 1. 我无法在angularJS 1中使用编辑功能。
I am using Laravel 5.4 as an API for my backend. 我正在使用Laravel 5.4作为后端的API。 It spits out all the JSON and what not.
它吐出所有JSON,而没有吐出。 I checked out my edit method in Laravel using PostMan and it is working fine.
我使用PostMan在Laravel中签出了我的编辑方法,并且工作正常。
I am having trouble understanding how I can implement that into AngularJS with Ionic. 我很难理解如何使用Ionic将其实现到AngularJS中。
So below I have provided my form I am using, the controller function I am using. 所以下面我提供了我正在使用的表格,我正在使用的控制器功能。
eventUpdate.html eventUpdate.html
<form id="eventForm-form1" class="list" role="form" >
<label class="item item-input item-stacked-label" id="eventForm-input2">
<span class="input-label">{{editEvent.event_description}}</span>
<input type="text" ng-model="editEvent.event_title" required="true">
</label>
<label class="item item-input item-stacked-label" id="eventForm-input3">
<span class="input-label">Description</span>
<input type="text" ng-model="editEvent.event_description" required="true">
</label>
<label class="item item-input item-stacked-label" id="eventForm-input4">
<span class="input-label">Location</span>
<input placeholder="123 Maple Lane" type="text" ng-model="editEvent.event_location" required="true">
</label>
<label class="item item-input item-stacked-label" id="eventForm-input5">
<span class="input-label">Date</span>
<input type="date" ng-model="editEvent.event_date" required="true">
</label>
<label class="item item-input item-stacked-label" id="eventForm-input6">
<span class="input-label">Time</span>
<input type="time" ng-model="editEvent.event_time" required="true">
</label>
</div>
<a ui-sref="tabsController.eventView" id="eventForm-button1" class="button button-positive button-block ng-click="update()"">Create Event</a>
<input type="button" ng-click="reset(form)" value="Reset" />
<div class="modal-footer">
<button type="button" ng-click="update()" >Update</button>
</div>
</form>
App.js App.js
ThesisApp.controller('UpdateController',['$scope', '$http',
'$ionicLoading', '$routeParams', function($scope, $http, $ionicLoading,
$routeParams){
$scope.edit = function(){
$http.get("http://thesis-app.dev/events/edit/"+$routeParams.id)
.success(function(response){
console.log('get info');
$scope.editEvent = response;
})
.error(function(response) {
console.log("not working");
});
}
}]);
Try changing this line: 尝试更改此行:
<button type="button" ng-click="update()" >Update</button>
to 至
<button type="button" ng-click="edit()" >Update</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.