Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lhridley
Created April 22, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lhridley/c22aa909859fca20eb2e to your computer and use it in GitHub Desktop.
Save lhridley/c22aa909859fca20eb2e to your computer and use it in GitHub Desktop.
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