i am new in angular js.
just like to know about few line like what they does.
- app.directive('fancybox', function($compile) {
- return {
- restrict: 'A',
- replace: false,
- link: function($scope, element, attrs) {
-
- $scope.open_fancybox = function() {
-
- var el = angular.element(element.html()),
-
- compiled = $compile(el);
-
- $.fancybox.open(el);
-
- compiled($scope);
-
- };
- }
- };
- });
below these lines are not clear.
var el = angular.element(element.html()), - compiled = $compile(el);
- $.fancybox.open(el);
- compiled($scope);
1) what $compile does and what it return after compile ? 2) when we need to compile scope like compiled($scope);
i have test the if i comment this line compiled($scope); then value is not putting into expression.......why ?
please guide me in detail. thanks