显示类别Id mean.js中的文章

时间:2016-12-02 17:00:50

标签: angularjs node.js mean-stack

链接菜单

<a ui-sref="articles.list-nav({category: category.name})">
  {{ category.name }}</a>

路线客户:

.state('articles.list-nav', {
        url: '/:category/articles',
        templateUrl: 'modules/articles/views/list-articles-scategory.client.view.html',
        controller: 'ArticlesController'
      })

列出文章类别:

<a class="md-12-line" ng-repeat="article in getArticles(category.id) ">

控制器客户端:

$scope.getAticles = function(category){
             var result = [];
             for(var i = 0 ; i < $scope.articles.length ; i++){
                 if(category === $scope.articless[i].category){
                     result.push($scope.articles[i]);
                 }
             }
             console.log(category);
             return result;
         };

我尝试了另一种方式:

控制器客户端:

 $scope.subCat = $stateParams.subcategoria;

列出文章类别:

<a class="md-12-line" ng-repeat="article in article | Filter: {(category: category.id)} ">

我需要的示例: menu IT:IT类别的所有文章 菜单营销:所有文章分类营销

但是不管怎样,我可以帮助我吗?

0 个答案:

没有答案