Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- var module = angular.module('footballApp', ['ngRoute']);
- module.factory('footballersFactory', footballersFactory);
- footballersFactory.$inject = [
- '$http'
- ]
- function footballersFactory($http) {
- return {
- getFootballers: function() {
- return $http({
- method: "GET",
- url: "/footballers"
- })
- }
- }
- }
- })();
- (function() {
- angular
- .module('footballApp', [])
- .directive('footballersData', footballersData);
- footballersData.$inject = [
- 'footballersFactory',
- '$scope'
- ];
- function footballersData($scope) {
- return {
- restrict: 'E',
- templateUrl: './frontend/templates/footballersData.html',
- link: function() {
- footballersFactory.getFotballers().success(function(data){
- $scope.footballers = data;
- console.log($scope.footballers);
- })
- }
- };
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement