редактировать данные в другом виде, используя laravel и angularjs

Я должен сделать приложение todo, используя angularjs и laravel. Я новичок во всем этом.
Я всегда получаю эту ошибку в моей консоли:

Error: [$parse:syntax] http://errors.angularjs.org/1.3.0/$parse/syntax?p0=todos.id&p1=is%20unexpected%2C%20expecting%20%5B%3A%5D&p2=12&p3=showById(%7B%7Btodos.id%7D%7D)&p4=todos.id%7D%7D)
at Error (native)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:6:416
at db.throwError (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:188:402)
at db.consume (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:189:335)
at db.object (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:197:110)
at db.primary (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:188:33)
at db.unary (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:194:273)
at db.multiplicative (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:194:6)
at db.additive (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:193:386)
at db.relational (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js:193:250) <form id="addTodoForm" role="form" ng-init="showById({{todos.id}})" class="ng-pristine ng-valid">

Я действительно не знаю, в чем проблема.

код в todoController.js:

  $scope.showById = function(id){
//console.log(window.location.pathname.split('/')[1]);
TodoAPI.show(id)
.success(function(data){
//console.log(data);
$scope.todo= data.todos;
// console.log($scope.todo);

})
.error(function(error){
console.log(error);
});
};

код в режиме редактирования:

@extends('layouts.frontend')

@section('content')
<div class="row calendarTitle" ng-app="IMDCommunity" ng-controller="TodoController">
<p>{{$task->id}}</p>

<div class="row calendarTitle" ng-app="IMDCommunity" ng-controller="TodoController" ng-init="showById({{$task->id}})">
<div class="col-md-12">
<h2 class="text-center">Edit task item</h2>
</div>
</div>
<form id="addTodoForm" role="form" ng-init="showById(@{{todos.id}})">

<form id="addTodoForm" role="form" >
<div class="form-group">
<label for="task">Task name</label>
<input ng-model="task.name" type="text" class="form-control" id="task" value="@{{todos.name}}">
<label for="dueDate">Due date</label>
<input ng-model="task.dueDate" type="date" class="form-control" id="dueDate" value="@{{todos.dueDate}}">
<label for="priority">Priority (min: 0, max: 10)</label><br>
<input class="form-control"  ng-model="task.priority" type="number" name="priority" id="priority"  min="0" max="10" value="@{{todos.priority}}">
</div>
<button ng-click="save()" type="submit" class="btn btn-default">Save task</button>
</form>

@stop

Я также сделал функцию шоу:

public function show($id)
{
// show only one specific notification
$todos = \Task::find($id);
$response = array("status" => "success", "todos" => $todos);
return \Response::json($response);
}

Поэтому я сделал JSON для хранения своих данных в нем. так что я могу показать эти данные в форме, где я могу редактировать эти данные. Кто-нибудь видит ошибку, которую я сделал?

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector