将数据从ng-repeat传递到其他页面

时间:2018-09-05 09:09:21

标签: angularjs

我有一个网站,我在该网站上使用Express在后端进行路由。在前端,我使用Angular。该页面包含一些我存储在MongoDB数据库中的新闻消息。单击邮件的“阅读更多”按钮时,我想打开一个包含有关该新闻消息的信息的新页面。这些新闻消息在前端显示为ng-repeat,但是我不知道如何将这些数据传递到新页面。

这是有关ng-repeat的新闻消息:

.news_slider.flex
   .news_block(ng-repeat="x in news_item")
      .upper_image
         img(lazy-src="/uploads/{{x.image}}.jpg" animate-visible="true" animate-speed="0.5s")
       .lower_text
          .title.dark {{x.title}}
          .time_stamp {{x.time}}
          .text_block(ng-bind-html="x.message") {{x.message}}
          a(href="/nieuwsberichten/{{x.title}}/{{x._id}}" target="_self")
          .read_more
             .main_button.yellow Lees Meer

我使用Angular对后端进行HTTP调用以检索数据

App.controller("front_page_controller", function($scope, $http){
$scope.showData = function(){
  $scope.news_item = {};
  $http.get("/news_blocks").then(function (response){
      $scope.news_item = response.data; 
    });
  };
});

0 个答案:

没有答案
相关问题