'use strict';
// Declare app level module which depends on views, and components
var thisApp = angular.module('thisApp', []);
thisApp.directive('fullscreenBlock', ['$compile', function ($compile) {
var jqLite = angular.element;
var link = function (scope, element, attrs) {
// Compiles DEFAULT icon button for opening the fullscreen mode.
// fullscreenButton can be overridden by passing html code as a value of `fullscreen-block` attribute.
var fullscreenButton = function () {
return jqLite($compile(
'<div class="row">' +
'<div class="col-md-10 col-sm-10 col-xs-10">' +
// Scope information
'<p>(scope id: <b>' + scope.$id + '</b>)</p>' +
'<p>(parent scope id: <b>' + scope.$parent.$id + '</b>)</p>' +
'</div>' +
'<div class="col-md-2 col-sm-2 col-xs-2">' +
'<span class="pull-right" name="fullscreen" ng-click="fullscreenMode($event)" tooltip="Expand" style="cursor: pointer"><i class="glyphicon glyphicon-fullscreen"></i></span>' +
'</div>' +
'</div>'
)(scope));
};
element.prepend((attrs.fullscreenBlock.length > 0) ? attrs.fullscreenBlock : fullscreenButton());
};
// Function helps to find the first parent element
// which contains 'fullscreen-block' attribute.
// This function can be replaced with JQuery's `closest()` method
// if JQuery library is in use.
var closest = function (element) {
return (jqLite(element).parent().attr('fullscreen-block') !== undefined) ?
jqLite(element).parent() :
closest(jqLite(element).parent());
};
var controller = function ($scope) {
// Handles click event
$scope.fullscreenMode = function (event) {
var modalWrapper = '<modal-wrapper></modal-wrapper>';
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.