SharePoint Pals
 | Sign In
Floating panel for angular js
by Krishna KV 16 Apr 2016
Team Leader, Aspire Systems
Today  :   4     Total  :    8160

JSPanel is one of the popular jQuery plugin for creating dynamic re-sizeable panels. In this article we can see how to create a Angualr Js directive for Js Panel so that it can be used in an application in Angular way.

Intro to jsPanel

JSPanel can be used as floating panel, model window or as tooltip. The content can be loaded using static or ajax content.  JsPanel comes with a set of in-built icons but we are free to use Bootstrap or font awesome icons and override the default ones. As this is a jQuery plugin, jQuery 1.9 or above and jQuery UI 1.9 or above is a pre-requisite for this plugin.

Angular Directive

 app.directive('floatingPanel', function () {
     return {
         restrict: 'A',
         scope: {
             parentTag: '@',
             title: '@',
             content: '@',
             theme: '@',         
         link: function (scope, elem, attrs) {
             var config =
                 title: scope.title == undefined ? '' : scope.title,
                 position: "center",
                 size: { width: 450, height: 250 },
                 content: scope.htmlTag == undefined ? scope.content : $('#'+ scope.htmlTag),
                 theme: scope.theme == undefined ? 'success' : scope.theme,
             var size, position;
             if (scope.parentTag != undefined) {
                 var element = $('#' + scope.parentTag);
                 var pos = element.offset();
                 config.size = { width: element.width(), height: element.height() };
                 config.position = { top:, left: pos.left }
             var panel1 = $.jsPanel({

parentTag – to set the height, width position based on the html tag
title – to add the title for the panel
content – string parameter, which can be html or plain text.  Or htmlTag – to load the html content  from the page (id as the value).
theme -  to add the theme for the panel.


 var app = angular.module('appModule', []);
 (function () {
     app.controller('mainController', ['$scope', function ($scope) {
         $scope.title = "Title";
         $ = new Date().toUTCString();
         $scope.onclick = function () {
             $ = new Date().toUTCString();


 <!DOCTYPE html>
 <html ng-app="appModule">
 	<meta charset="utf-8" />
     <link href="Content/jquery-ui.complete.min.css" rel="stylesheet" />
     <link href="Content/jquery.jspanel.css" rel="stylesheet" />
     <link href="Content/bootstrap.css" rel="stylesheet" />
     <link href="Content/app.css" rel="stylesheet" />
 <style type="text/css">
         border:1px solid gray;
         <div ng-controller="mainController" style="width:100%;height:550px">
             <div style="width:38%;height:100%;float:left" class="border" id="leftDiv">
                 <div id="hcontent">
                     <p style="margin-right:20px;font-size:20px;color:blue">
                         <button type="button" class="btn btn-default" ng-click="onclick()">Click</button>
                 <div floating-panel title="Left" parent-tag="leftDiv" html-tag="hcontent"></div>
             <div floating-panel title="Right" parent-tag="rightDiv" content="<h1>Test</h1><p>This is paragraph</p>"></div>
             <div style="width:60%;height:100%;float:right" class="border" id="rightDiv">
     <script src="Scripts/jquery-2.1.4.min.js"></script>
     <script src="Scripts/jquery-ui-complete.min.js"></script>
     <script src="Scripts/vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js"></script>
     <script src="Scripts/jquery.jspanel.js"></script>
     <script src="Scripts/angular.js"></script>
     <script src="app/app.js"></script>
     <script src="app/app.directive.js"></script>





blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter January 15, 00:25
How To Enable Target Value And Actual Value In #D3 Gauge Chart

Twitter January 15, 00:24
How To Open #SharePoint List Hyperlink Column In Modal #Popup Window

Twitter January 15, 00:24
Quick Introduction To #Asp.NetCore And It’s Features

Twitter January 15, 00:22
How To Configure #PerformancePoint Services To Use Secure Store In #SharePoint 2013

Twitter January 15, 00:21
How To Block Or Disable #Office365 Services

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation