Created
April 22, 2015 14:39
-
-
Save lhridley/c22aa909859fca20eb2e to your computer and use it in GitHub Desktop.
ang.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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