Display items of a given ID using angular GET

0

I am doing a very basic forum where the user types the title, subject and description of the topic, and this one is sent to the mongo (I am also using the postman), with the help of the staff here in another topic, this part ja finalizei . In the index appears all the registered topics and an access button to view certain topic, that is, each topic has an id. The question is: how to display each item of a given id? Here's what I've already done, with the help of some users here:

Note: _id is the code of the topic

function ListaTopicosController($scope, $http) {

...

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

myApp.controller('forumList', ['$scope', '$http', function($scope, $http) {

   $scope.carregarDados = function() {
      var url = 'http://localhost:3000/topico/lista'
      $http.get(url, {id: $scope.data._id}).then(
            function successCallback(resposta) {
               $scope.forum.titulo = resposta.data.titulo;
            },
            function errorCallback(resposta) {
            }
        );
   }
}]);
<body ng-app="myApp" ng-controller="ListaTopicosController" >
  <div class="jumbotron text-center">
    <h1><font color="#00c6d7">ALLDISPOR</font></h1>
    <p>Fórum de Discussão</p>
  </div>
  
 
 
	<div class="container">
    <div class="row">
      <div ng-controller="forumList" ng-init="carregarDados()">
 <h2>{{ forum.titulo }}</h2>
 <h4> {{ forum.assunto }}</h4>
</div>
    
asked by anonymous 12.08.2016 / 02:11

0 answers