Angular有重复

时间:2014-12-15 21:53:59

标签: angularjs

我得到的错误是ngRepeat:Dupes
我使用的是1.2.9

盲目更新到新版本或最新版本没有任何好处。

<script>
window.onload = ShoppingCartCtrl

function ShoppingCartCtrl($scope, $http)  {


        $scope.items = {[$data]}    

        //we want the 1st load to be sorted by sort_code
        $scope.sortExpression = 'sort_code';

        $scope.mySortFunction = function(item) {
            if(isNaN(item[$scope.sortExpression]))
                return item[$scope.sortExpression];
            return parseInt(item[$scope.sortExpression]);
        }       

        $scope.refreshSessionList = function(){
            //alert($scope.conference_year);

            $http({
                method: 'POST',
                url: 'browser.php?conference_year='+$scope.conference_year,
                headers:{'Content-type' : 'application/x-www-form-urlencoded; charset=UTF-8'}           

                });   

        }

}


</script>


<div class="row">
      <div class="large-12 columns">

<div ng-app>
        <div ng-controller="ShoppingCartCtrl">        
      <!-- angularJS version -->      

            <br />
            <div><strong>Filter Results</strong></div>

            <table>
                <form action="browser.php" method="POST" id="conference_year_form">
                <tr><td>By Conference Year:</td>
                <td> 

                {[html_options id=conference_year name=conference_year options=$myOptions selected=$mySelectedConferenceYear  onChange="this.form.submit()"]}
                </td></tr>
                </form>

                <tr>
                    <td>By Session Title: </td>
                    <td><input type="text" ng-model="search.pname" /></td>
                </tr>
                <tr>
                    <td>By Session Code: </td>
                    <td><input type="text" ng-model="search.product_code" /></td>
                </tr>
                <tr>
                    <td>By Presentation Title: </td>
                    <td><input type="text" ng-model="search.presentations" /></td>
                </tr>
                <tr>
                    <td>By Session Speaker: </td>
                    <td><input type="text" ng-model="search.speakers" /></td>
                </tr>
                    <tr>
                    <td>By Product Number: </td>
                    <td><input type="text" ng-model="search.productNumber" /></td>
                </tr>
            </table>
            <br />
             <div class="row">
      <div class="small-3 columns">
            <div>Sort by: 

            <select ng-model="sortExpression">

                    <option value="sort_code">Session Code</option>
                    <option value="pname">Session Title</option>
                    <option value="productNumber">Product Number</option>

                </select>
            </div>

        </div>
        </div>
        <br/>
           <table border="0">
                <thead>
                    <tr>
                        <th>Session Code</th>

                        <th>Session Title</th>
                        <th>Product Number</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="item in items | orderBy:mySortFunction | filter:search">
                        <td valign="top"><h3><a href="./publicAccess.php?id={{item.id}}">{{item.product_code}}</a></h3></td>

                        <td><h3><a href="./publicAccess.php?id={{item.id}}">{{item.pname}}</a></h3>

                        <br/>
                            {{item.speakers}}
                        </p>

                        <br/>
                        <h6>{{item.free_viewing}}</h6>
                        </td>

                        <td>{{item.productNumber}}</td>

                    </tr>

                </tbody>
            </table>


            <br />
</div>
</div>

</div>
</div>

以下是数据样本:

  • 2013年活动| 2013 | A1 | A01 |标题名称
  • 2013年活动| 2013 | C10 | C10 |标题名称

可能是由于欺骗代码C10和C10?

1 个答案:

答案 0 :(得分:0)

我的问题是数据库中的字符编码。 我必须明确要求utf8。

当我尝试在PHP中使用utf_encode时,没有好处。

因此,使用adodb的PHP解决方案就是:

$this->dsource->Execute("set names utf8");