0

I have a website where I do my routing with Express on the backend. On the frontend I use Angular. The page contains some news messages that I store in MongoDB database. When the read-more button of the message is clicked, I want to open a new page with the info about that news message. These news messages are shown with ng-repeat on the front-end, But I don't know how I can pass this data to a new page.

This is the news message on 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

I do a HTTP call with Angular to the backend to retrieve the data

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; 
    });
  };
});
Gandalf the White
  • 2,415
  • 2
  • 18
  • 39
Larsmanson
  • 413
  • 1
  • 5
  • 18
  • Please pay attention to the tags... This is an AngularJS question. "angular" tag refers to v 2 -> – AT82 Sep 05 '18 at 09:11
  • This is more about you trying to pass data from one controller to another if I am not wrong because your new page will be bound to it. Either you can send it directly or you can use a system which will have data to be used for multiple things. https://stackoverflow.com/questions/18856153/how-can-i-pass-some-data-from-one-controller-to-another-peer-controller Take a look at this – Gandalf the White Sep 05 '18 at 09:15

0 Answers0