Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度JS和来自REST的内联编辑数据_Javascript_Html_Angularjs_X Editable - Fatal编程技术网

Javascript 角度JS和来自REST的内联编辑数据

Javascript 角度JS和来自REST的内联编辑数据,javascript,html,angularjs,x-editable,Javascript,Html,Angularjs,X Editable,我是个新手 我正在阅读JSONP响应并在页面中显示它。我想允许用户在线编辑部分文本。我发现角度是可编辑的。但我不明白 1.如何在中继器中使用它。我花了几个小时尝试使用内联编辑。如果它不在中继器中,它就会工作。否则会破坏一切 我有这个: 在我的app.js中: var app = angular.module('ListApp', ['ui.bootstrap']).config(['$httpProvider', function ($httpProvider) { $httpP

我是个新手

我正在阅读JSONP响应并在页面中显示它。我想允许用户在线编辑部分文本。我发现角度是可编辑的。但我不明白 1.如何在中继器中使用它。我花了几个小时尝试使用内联编辑。如果它不在中继器中,它就会工作。否则会破坏一切

我有这个:

在我的app.js中:

var app = angular.module('ListApp', ['ui.bootstrap']).config(['$httpProvider', function ($httpProvider)
{
        $httpProvider.defaults.useXDomain = true;
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);;

var app11 = angular.module("app11", ["xeditable"]);

app11.run(function (editableOptions) {
    editableOptions.theme = 'bs3'; // bootstrap3 theme. Can be also 'bs2', 'default'
});

app11.controller('Ctrl', function ($scope) {
    $scope.user = {
        name: 'awesome user'
    };
});



angular.element(document).ready(function () {
    angular.bootstrap(document.getElementById('list-reminders'), ['ListApp']);
    angular.bootstrap(document.getElementById('xedittxt'), ['app11']);
});
在我的html中:

<div id="list-reminders" class="container main-frame" ng-controller="remindersController" ng-init="init()">
            <div class="search-box row-fluid form-inline">
                <nobr>
                    <label>Find</label>&nbsp;
                    <input type="text" ng-model="searchText" value="{{searchText}}" />&nbsp;<input type="submit" class="submit" ng-click="getRemindersByUserId()" value="Search">
                </nobr>
            </div>

            <div class="results-top"></div>
            <div class="results-container">
                <div class="row-fluid">                   
                    <div class="span1">Title</div>
                    <div class="span2">My Notes</div>          

                </div>
                <ul class="item-list" style="display:none;">

                    <li ng-repeat="(key,item) in lists">
                        <div class=" row-fluid">

                            <div id="xedittxt" ng-controller="Ctrl" class="span2">
                                <a href="" editable-text="{{item.user_reminder_title}}"></a>
                            </div>                            
                            <div class="span2">{{item.user_notes}} </div>

                        </div>
                    </li>
                </ul>
app.controller("remindersController", function ($scope, $modal, $http) {

    $scope.items = [];
    //api

    $scope.getListApi = '....URL REMOVED';
    var callback = 'callback=JSON_CALLBACK';

    $scope.init = function () {

        //items selected from results to add to list
        $scope.selectedItems = [];

        var $loading = $('.loading');
        var $searchOptions = $('.search-options');
        var $itemList = $('.item-list');

        $scope.getRemindersByUserId = function (userId) {
            $itemList.hide();
            $loading.show();

            var getListUrl = $scope.getListApi + "1&" + callback;

            console.log(getListUrl);

            $http.jsonp(getListUrl).success(function (data) {

                $scope.lists = data;
                $loading.hide();
                $itemList.show();

            }).error(function (err) {
                console.log("getRemindersByUserId error: " + err);
            });

        };

    };

});