Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ang.js
(function() {
'use strict';
angular.module('nodeListing', ['ngResource', 'ngDialog'])
// Factory for the ngResource service.
.factory('Node', function($resource) {
return $resource(Drupal.settings.basePath + 'api/node/:param', {}, {
'search' : {method : 'GET', isArray : true}
});
})
.controller('ListController', ['$scope', 'Node', 'ngDialog', function($scope, Node, ngDialog) {
// Initial list of nodes.
$scope.nodes = Node.query();
// Callback to load the node info in the modal
$scope.open = function(nid) {
$scope.loadedNode = Node.get({param: nid});
ngDialog.open({
template: 'loadedNodeTemplate',
scope: $scope
});
};
}]);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment