Guest User

Untitled

a guest
Dec 16th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. app.directive('photo', ['$http', 'modal', function($http, modal) {
  2. return {
  3. replace: true,
  4. templateUrl: '/assets/photo.html',
  5. transclude: false,
  6. scope: {
  7. result: '=',
  8. index: '@'
  9. },
  10. controller: ['$scope', '$http', 'modal', function($scope, $http, modal) {
  11. $scope.prev = $scope.index - 1;
  12. $scope.open = function() {
  13. debugger;
  14. };
  15. }]
  16. }
  17. }]);
  18.  
  19. <div ng-repeat="r in results" photo result="r" index="$index"></div>
  20.  
  21. controller: function($scope) {
  22. $scope.prev = $scope.index - 1;
  23. $scope.open = function() {
  24. debugger;
  25. };
  26. }
  27.  
  28. $scope.open = function() {
  29. console.log($scope);
  30. debugger; //now you should see $scope.
  31. };
  32.  
  33. app.directive('photo', ['$http', 'modal', function($http, modal) {
  34. return {
  35. replace: true,
  36. templateUrl: '/assets/photo.html',
  37. transclude: false,
  38. scope: {
  39. result: '=',
  40. index: '@'
  41. },
  42. controller: function($scope, $http, modal) {
  43. $scope.prev = $scope.index - 1;
  44. $scope.open = function() {
  45. debugger;
  46. };
  47. }
  48. }
  49. }]);
  50.  
  51. var app = angular.module("moduleTest",[]);
  52. app.directive("testDirective",function(){
  53. return {
  54. restrict: "A",
  55. scope: true,
  56. link: function(scope, element){
  57. //code
  58. }
  59. }
  60. });
Add Comment
Please, Sign In to add comment