Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>your question is not clear enough for me it would be better if you put a <a href="http://plnkr.co/edit/gist:3510140" rel="nofollow">plunker</a> with an example code that would be easier to understand, but i'll try to answer from what I understand.<br> In you services.js file do something like this:</p> <pre><code>app.factory('Seeks', ['$http', function($http){ var Url = "seeks.json"; var Seeks = $http.get(Url).then(function(response){ return response.data; }); return Seeks; }]); app.factory('Offers', ['$http', function($http){ var Url = "offers.json"; var Offers = $http.get(Url).then(function(response){ return response.data; }); return Offers; }]); </code></pre> <p>in your controllers.js do something like this:</p> <pre><code>var SeekingCtrl = function($scope, Seeks) { Seeks.then(function(data){ $scope.seeks = data; }); $scope.addSeeks = function(newseeks) { $scope.seeks.push(newseeks); newseeks = ""; }; $scope.removeSeeks = function(seek) { $scope.seeks = _.without($scope.seeks, seek); }; }; var OfferingCtrl = function($scope, Offers) { Offers.then(function(data){ $scope.offers = data; }); $scope.addOffer = function(newoffer) { $scope.offers.push(newoffer); newoffer = ""; }; $scope.removeOffer = function(offer) { $scope.offers = _.without($scope.offers, offer); }; }; </code></pre> <p>And don't forget to inject the <code>Offers</code> and the <code>Seeks</code> into the controllers in the app.js file like this:</p> <pre><code>SeekingCtrl.$inject = ['$scope', 'Seeks']; OfferingCtrl.$inject = ['$scope', 'Offers']; </code></pre> <h2>update:</h2> <p>just put everything in one controller like this:</p> <pre><code>var MainCtrl = function($scope, Seeks, Offers) { Seeks.then(function(data){ $scope.seeks = data; }); Offers.then(function(data){ $scope.offers = data; }); $scope.addSeeks = function(newseeks) { $scope.seeks.push(newseeks); newseeks = ""; }; $scope.addOffer = function(newoffer) { $scope.offers.push(newoffer); newoffer = ""; }; $scope.removeSeeks = function(seek) { $scope.seeks = _.without($scope.seeks, seek); }; $scope.removeOffer = function(offer) { $scope.offers = _.without($scope.offers, offer); }; }; </code></pre> <h2>update 2:</h2> <pre><code>var MainCtrl = function($scope, Seeks, Offers) { Seeks.then(function(data){ $scope.seeks = data; }); Offers.then(function(data){ $scope.offers = data; }); $scope.add = function(item, type) { $scope[type].push(item); item = ""; }; $scope.remove = function(item, type) { $scope[type] = _.without($scope[type], item); }; }; </code></pre> <p>And the type could be seeks or offers.<br> For the services that's out of my league.<br> Hope this help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload