string
html
:
Html input.
string
:
Sanitized html.
<example module="sanitizeExample" deps="angular-sanitize.js">
<file name="index.html">
<script>
angular.module('sanitizeExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
$scope.snippet =
'<p style="color:blue">an html\n' +
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
'snippet</p>';
$scope.deliberatelyTrustDangerousSnippet = function() {
return $sce.trustAsHtml($scope.snippet);
};
}]);
</script>
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<td>Directive</td>
<td>How</td>
<td>Source</td>
<td>Rendered</td>
</tr>
<tr id="bind-html-with-sanitize">
<td>ng-bind-html</td>
<td>Automatically uses $sanitize</td>
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
<td><div ng-bind-html="snippet"></div></td>
</tr>
<tr id="bind-html-with-trust">
<td>ng-bind-html</td>
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
<td>
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
</div></pre>
</td>
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
</tr>
<tr id="bind-default">
<td>ng-bind</td>
<td>Automatically escapes</td>
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</div>
</file>
<file name="protractor.js" type="protractor">
it('should sanitize the html snippet by default', function() {
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
});
it('should inline raw snippet if bound to a trusted value', function() {
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should escape snippet without any filter', function() {
expect(element(by.css('#bind-default div')).getInnerHtml()).
toBe("<p style=\"color:blue\">an html\n" +
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
"snippet</p>");
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
toBe('new <b>text</b>');
expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
'new <b onclick="alert(1)">text</b>');
expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
"new <b onclick=\"alert(1)\">text</b>");
});
</file>
</example>
Add lost connections to localStorage variable last_connections
Add a new contact to group
Confirm block contact action
Confirm action Delete group
Confirm sign out from group action
Create a room group
Edit room group information
Notify when someone is typing a message.
Add a new contact to group
Set all messages on current popup as read
Toggle block contact action
Block a contact.
Array
Block a contact
Add contact to the blocked list
Conserve aspect ratio of the original region. Useful when shrinking/enlarging images to fit into a certain area. Source: http://stackoverflow.com/a/14731922
Number
srcWidth
:
Source area width
Number
srcHeight
:
Source area height
Number
maxWidth
:
Nestable area maximum available width
Number
maxHeight
:
Nestable area maximum available height
Object
:
{ width, height }
Connect to Chat API
Promise
Connect to Chat Hub
Promise
Create group
Create group
Return an Array of contacts passing a limit and offset (pagination).
Array
Return an Array of contacts passing a limit and offset (pagination).
Array
Fetch conversations list
Array
Fetch conversations list
Array
decodes all entities into regular string
string
:
A string with decoded entities.
Delete a room group
Drop lost connections
Promise
Escapes all potentially dangerous characters, so that the resulting string can be safely inserted into attribute or element text.
string
:
escaped text
Return second array param without same objects from first array param
Array
Get API Token
String
Get API URL
String
Return an Array of blocked contacts.
Array
Return an Array of blocked contacts.
Array
Get a list of blocked contacts
Array
Return an Array of blocked contacts.
Array
Return an Array of contacts from external API.
Array
Get user's contact list by endpoint
Array
Return an Array of contacts.
Array
Return an Array of contacts.
Array
Get Contacts API URL
String
Get a conversation by room id
Get a conversation by room id
Return an Array of conversations.
Object
options
:
{id, limit, offset}
Array
Return an Array of conversations passing a limit and offset (pagination).
Array
Get user's conversations
Array
Return an Array of conversations passing a limit and offset (pagination).
Array
Get GaiaCore Token
String
Get GaiaCore Token
String
Get Room messages
Array
Get user's contact list from network
Array
Returns Hub connection instance
Object
Get SignalR URL
String
Get the total number of notifications (messages unread)
Number
htmlParser(htmlString, {
start: function(tag, attrs, unary) {},
end: function(tag) {},
chars: function(text) {},
comment: function(text) {}
});
create an HTML/XML writer which writes to buffer
Array
buf
:
use buf.jain('') to get out sanitized html string
object
:
in the form of { start: function(tag, attrs, unary) {}, end: function(tag) {}, chars: function(text) {}, comment: function(text) {} }
Sign Out From Group
string
text
:
Input text.
string
target
:
Window (_blank|_self|_parent|_top) or named frame to open links in.
string
:
Html-linkified text.
<example module="linkyExample" deps="angular-sanitize.js">
<file name="index.html">
<script>
angular.module('linkyExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.snippet =
'Pretty text with some links:\n'+
'http://angularjs.org/,\n'+
'mailto:us@somewhere.org,\n'+
'another@somewhere.org,\n'+
'and one more: ftp://127.0.0.1/.';
$scope.snippetWithTarget = 'http://angularjs.org/';
}]);
</script>
<div ng-controller="ExampleController">
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
<table>
<tr>
<td>Filter</td>
<td>Source</td>
<td>Rendered</td>
</tr>
<tr id="linky-filter">
<td>linky filter</td>
<td>
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippet | linky"></div>
</td>
</tr>
<tr id="linky-target">
<td>linky target</td>
<td>
<pre><div ng-bind-html="snippetWithTarget | linky:'_blank'"><br></div></pre>
</td>
<td>
<div ng-bind-html="snippetWithTarget | linky:'_blank'"></div>
</td>
</tr>
<tr id="escaped-html">
<td>no filter</td>
<td><pre><div ng-bind="snippet"><br></div></pre></td>
<td><div ng-bind="snippet"></div></td>
</tr>
</table>
</file>
<file name="protractor.js" type="protractor">
it('should linkify the snippet with urls', function() {
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
});
it('should not linkify snippet without the linky filter', function() {
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
});
it('should update', function() {
element(by.model('snippet')).clear();
element(by.model('snippet')).sendKeys('new http://link.');
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
toBe('new http://link.');
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
.toBe('new http://link.');
});
it('should work with the target property', function() {
expect(element(by.id('linky-target')).
element(by.binding("snippetWithTarget | linky:'_blank'")).getText()).
toBe('http://angularjs.org/');
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
});
</file>
</example>
Load a script dynamically
Promise
Load user's preferences
Array
Merge isBlocked properties between contacts/blocked lists.
Array
Return an Array of contacts merged with blocked list.
Array
Merge data from a contact
Add a participant to a conversation
Add a participant to a conversation
Display error message when disconnected and invoke reconnect method when chat is disconnected
Display error message when disconnected and invoke reconnect method when chat is disconnected
Open a popup to confirm a partnership between incorp or community
Open a popup to confirm a partnership between incorp or community
Emit an event to notify a popup when the messages were read
Emit an event to notify a popup when the messages were read
Append new message from contact to conversation
Append new message from contact to conversation
Add typing flag to conversation
Add typing flag to conversation
Update the name of a conversation (Room)
Update the name of a conversation (Room)
Clear unread messages from a conversation (Room)
Watch for status change
Watch for status change
Reconnect chat.
Reconnect chat.
Remove conversation if user was removed and close popup (if it's open)
Remove conversation if user was removed and close popup (if it's open)
Check for last connection id to send a request and delete it
Remove a participant from a conversation
Remove a participant from a conversation
Remove typing flag from conversation
Remove typing flag from conversation
Save user's preferences
Search for conversations
Array
Search for contacts by name
Array
Search for conversations
Array
Search for conversations
Array
Search for conversations by name
Array
Send message to room
Start chat connection with Hub and API
Promise
Unblock a contact.
Array
Unblocked a contact.
Array
Remove contact from the blocked list
Block a contact
Push new contact to the list
Push new contact to the list
Find contact in list and replace current status from response data.
Find contact in list and replace current status from response data.
! AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, progress, resize, thumbnail, preview, validation and CORS