Hi, I have problem with my code today,

I don't know how to* orderBy* an element in an *array*.
I need to order in my *SELECT* the kills of every champions, yeah... league 
of legends.

 ^^' I'm trying to make a score classement.

here is my code :

*HTML *(index.html)
<!doctype
<html ng-app="ClassementChamps">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="css/local.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
</head>


<body ng-controller="ChampController as champ">

<!-- search champion -->

<section id="search">
    <label>search: <input type="text" ng-model="search"/></label>

    <select class="search" ng-model="order">
        <option value="score.kills">score.kills</option>
        <option value="sex">sex</option>
    </select>
</section>

<!-- main-content -->

<section id="main-content">

<ol>
    <li ng-repeat="information in champ.infos | filter:search | 
orderBy:order:true">
        <div class="champsCore">
            <a href="{{information.page}}">
                {{information.champion + ' is a ' + information.sex + ', ' 
+ information.lane}}
            </a>

            <p ng-repeat="score in information.score">
                Score: {{score.kills + ' / ' + score.mort + ' / ' + 
score.assistances}}.
            </p>
        </div>
    </li>
</ol>

</section>

<!-- footer -->

<section id="footer">
    <div id="totalChamps" ng-hide="search">
            there is 
            <strong>{{remaining}}</strong> champs, 
            <strong>{{adc}}</strong> marksam, 
            <strong>{{support}}</strong> support.
        </p>
    </div>
</section>

<script type="text/javascript" src="lib/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script>document.write('<script src="http://' + (location.host || 
'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 
'script>')</script>
</body>
</html>


*JAVASCRIPT* (app.js)

var app = angular.module('ClassementChamps', []);

app.controller('ChampController', ['$http', '$scope', 'filterFilter', 
function($http, $scope, filterFilter){
        var champ = this;
        champ.infos = [];

        $http.get('js/champions.php').success(function(data){
            champ.infos = data;
        });


        $scope.$watch('champ.infos', function(){
            $scope.remaining = $scope.champ.infos.length;
        }, true);

        $scope.$watch('champ.infos', function(){
            $scope.adc = filterFilter($scope.champ.infos, {lane:'marksam'}).
length;
        }, true);

        $scope.$watch('champ.infos', function(){
            $scope.support = filterFilter($scope.champ.infos, {lane:
'support'}).length;
        }, true);


                
        }]);


Data* JSON* in php file

[



{

 "champion": "Ashe",
 "sex":"female",
 "lane":"marksam",
 "page":"#Ashe",
 "score":[{"kills":"9", "mort":"2", "assistances":"5"}]


},
{

 "champion": "Graves",
 "sex":"male",
 "lane":"marksam",
 "page":"#Graves",
 "score":[{"kills":"12", "mort":"4", "assistances":"1"}]
 
},
{

 "champion": "Leona",
 "sex":"female",
 "lane":"support",
 "page":"#Leona",
 "score":[{"kills":"2", "mort":"0", "assistances":"8"}]

},
{

 "champion": "Sona",
 "sex":"female",
 "lane":"support",
 "page":"#Sona",
 "score":[{"kills":"1", "mort":"4", "assistances":"17"}]

}



]

What should I do ? I need to orderBy kills (in score) and orderBy every 3 
of theme directly.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to