Angular doesn’t depend on jQuery. In fact, the Angular source contains an embedded lightweight alternative: jqLite. Still, when Angular detects the presence of a jQuery version in your page, it uses that full jQuery implementation in lieu of jqLite. One direct way in which this manifests itself is with Angular’s element abstraction. For example, in a directive you get access to the element that the directive applies to:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Curry takes a two argumented function and returns one func that returns a second func that each take one argument. | |
| */ | |
| function curry (func) { | |
| return function (x) { | |
| return function (y) { | |
| return func (x, y); | |
| }; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var uuids = angular.module('uuids', []); | |
| uuids.factory("rfc4122", function () { | |
| return { | |
| newuuid: function () { | |
| // http://www.ietf.org/rfc/rfc4122.txt | |
| var s = []; | |
| var hexDigits = "0123456789abcdef"; | |
| for (var i = 0; i < 36; i++) { | |
| s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * http://kevin.vanzonneveld.net | |
| * original by: Webtoolkit.info (http://www.webtoolkit.info/) | |
| * namespaced by: Michael White (http://getsprink.com) | |
| * tweaked by: Jack | |
| * improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
| * input by: Brett Zamir (http://brett-zamir.me) | |
| * bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
| * depends on: utf8_encode | |
| * example 1: md5('Kevin van Zonneveld'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| * Anchor Smooth Scroll - Smooth scroll to the given anchor on click | |
| * adapted from this stackoverflow answer: http://stackoverflow.com/a/21918502/257494 | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
| angular.module('yourapp').directive('anchorSmoothScroll', function($location) { | |
| 'use strict'; | |
| return { | |
| restrict: 'A', | |
| replace: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*===================================================== | |
| * | |
| * Sitef Date : A javascript library that handles dates in a way that fits Sitef's needs | |
| * (c) Luiz Augusto Crisostomo 2014 | |
| * | |
| ======================================================*/ | |
| function SitefDate(date) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Fancy ID generator that creates 20-character string identifiers with the following properties: | |
| * | |
| * 1. They're based on timestamp so that they sort *after* any existing ids. | |
| * 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
| * 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
| * 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
| * latter ones will sort after the former ones. We do this by using the previous random bits | |
| * but "incrementing" them by 1 (only in the case of a timestamp collision). | |
| */ |
OlderNewer