title: how to connect 2 objects in ionic via backand
body: <p>i need a bit of help to my ionic project. so i want to connect 2 objects in ionic, so that i can display the value of and object that has data from the other object.</p>
  
  <pre><code>&lt;ion-list class="list-inset"&gt;
    &lt;ion-item class="item-text-wrap" ng-repeat='item in todos| filter:firma'&gt;
    &lt;h2&gt;{{item.company_name}}&lt;/h2&gt;
   &lt;/ion-item&gt;
   &lt;ion-item class="item-text-wrap" ng-repeat='item in todos2 | filter:{ idcompany:com_id } '&gt;
   &lt;h2&gt;ponedeljek {{item.time_mon_start}}-{{item.time_mon_end}}&lt;/h2&gt;
   &lt;h2&gt;torek {{item.time_tue_start}}-{{item.time_tue_end}}&lt;/h2&gt;
   &lt;h2&gt;sreda {{item.time_wed_start}}-{{item.time_wed_end}}&lt;/h2&gt;
   &lt;h2&gt;četrtek {{item.time_thu_start}}-{{item.time_thu_end}}&lt;/h2&gt;
   &lt;h2&gt;petek {{item.time_fri_start}}-{{item.time_fri_end}}&lt;/h2&gt;
   &lt;h2&gt;sobota {{item.time_sat_start}}-{{item.time_sat_end}}&lt;/h2&gt;
   &lt;h2&gt;nedelja {{item.time_sun_start}}-{{item.time_sun_end}}&lt;/h2&gt;
  &lt;/ion-item&gt;
  </code></pre>
  
  <p>
  this is what i want to display for the current company that i click on, but it shows all the times not only one that i want. </p>
  
  <pre><code>.controller('AppCtrl', function($scope, TodoService, cas, $state) {
  $scope.todos = [];
  $scope.todos2 = [];
  
  function getAllTodos() {
    TodoService.getTodos().then(function (result) {
      $scope.todos = result.data.data;
      $scope.firma = $state.params.aid;
  
    });
  }
  getAllTodos();
  
  function getalltimes() {
    cas.getcompany().then(function (result) {
   $scope.todos2 = result.data.data;
  });
  
  }
  
  getalltimes();
  })
  
  .service('TodoService', function ($http, Backand, $state) {
  var baseUrl = '/1/objects/';
  var objectName = 'companies/';
  
  function getUrl() {
  return Backand.getApiUrl() + baseUrl + objectName;
  }
  function getUrlForId(id) {
  return getUrl() + id;
  
  }
  getTodos = function () {
  return $http.get(getUrl());
  };
  return {
  getTodos: getTodos
  }
  })
  
  .service('cas', function ($http, Backand, $state) {
  var baseUrl = '/1/objects/';
  var time = 'companies_timetable/';
  
  function getUrl2() {
  return Backand.getApiUrl() + baseUrl + time;
  }
  getcompany = function () {
  return $http.get(getUrl2());
  };
   return {
  getcompany: getcompany
  }
  })
  </code></pre>
  
  <p>this is now my app.js file and my connection to the backand service. this is working fine.</p>
  
  <p><a href="http://i.stack.imgur.com/PG9UD.png" rel="nofollow">this are the companys from object 1</a></p>
  
  <p><a href="http://i.stack.imgur.com/WOZvq.png" rel="nofollow">and this are the times showing</a></p>
  
  <p>so when you click on the companys it should show the time for it. but here it shows all times that are in the object. i should show only one for the one company
  i was trying to give all objects in one array (todos). but didn't worked rlly well. so please i need some help. if you need some more code or somthing just say it :).</p>