Show user name responsible for such non html ID

1

I'm not sure what to do, but I'm not sure what to do. When creating a new topic, this topic creates an ID or each topic has yours.  In the Index there is a list of topics created and an access button that leads to a certain topic. My question is how to show the title, subject and description of the topic accessed on the test page. Note: I'm using mongod and postman to register the data, and the url where the data is is link

Below the button and js

 $scope.AcessarTopico = function(index){
        //$scope.item = $scope.itens[this.id:id];
        alert("o id do cara é - " + $scope.itens[index]._id);
        window.location="file:///C:/Users/Mayla/Desktop/Forum/teste.html?id="+$scope.itens[index]._id;
        $scope.edit = true;
<button class="btn btn-success btn-small" ng-click="AcessarTopico($index)">
    
asked by anonymous 06.08.2016 / 04:44

1 answer

1

Your role is requesting a new page, and passing the forum id in question. In this new page the ideal is to have a controller and in it a method that at the start make the search of the data of this forum in specific. Something like this:

In the test.html

<div ng-controller="forumList" ng-init="carregarDados()">
 <h2>{{ forum.titulo }}</h2>
 <h4> {{ forum.assunto }}</h4>
</div>

In the angle controller:

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

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

   $scope.carregarDados = function() {
      var url = sua_url;
      $http.get(url, {id: pegue_id_da_pagina).then(
            function successCallback(resposta) {
               $scope.forum = resposta.data.forum;
            },
            function errorCallback(resposta) {
            }
        );
   }
}]);
    
07.08.2016 / 19:13