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
| app.module['myApp'].directive('imageOnload', function() { | |
| return { | |
| restrict: 'A', | |
| link: function(scope, element, attrs) { | |
| element.bind('load', function() { | |
| // call the function that was passed | |
| scope.$apply(attrs.imageOnload); | |
| // usage: <img ng-src="src" image-onload="imgLoadedCallback()" /> | |
| }); |
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
| .animated-ng-if { | |
| &.ng-enter { | |
| transition: max-height 350ms ease-in; /* transition the height FROM 0 to x when entering (autoprefix or use mixin) */ | |
| max-height: 0; | |
| } | |
| &.ng-enter.ng-enter-active, | |
| &.ng-leave { | |
| max-height: 600px; /* max-height when active (adjust value to fit needs) */ | |
| } | |
| &.ng-leave.ng-leave-active { |
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
| // Define an object with init function and add methods | |
| var Person = { | |
| init: function(name, gender) { | |
| this.name = name; | |
| this.gender = gender; | |
| }, | |
| speak: function() { | |
| alert('Howdy, my name is ' + this.name); | |
| } | |
| }; |
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
| grunt.registerTask('beep', 'beep!', function() { grunt.log.writeln('\x07').ok(); }); // beep! |
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
| // Define a class like this | |
| function Person(name, gender) { | |
| // Add object properties like this | |
| this.name = name; | |
| this.gender = gender; | |
| } | |
| // Add methods like this. All Person objects will be able to invoke this | |
| Person.prototype.speak = function() { | |
| alert('Howdy, my name is ' + this.name); |
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 urlDomain = window.location.hostname.replace('www.', ''); | |
| app.config('$sceDelegateProvider', function($sceDelegateProvider) { | |
| $sceDelegateProvider.resourceUrlWhitelist([ | |
| 'self', | |
| 'http://*.' + urlDomain + '/**' | |
| ]); | |
| }); |
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
| myApp.filter('trustAsHTML', ['$sce', function($sce){ | |
| return function(text) { | |
| return $sce.trustAsHtml(text); | |
| }; | |
| }]); |
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
| app.filter('startFrom', function() { | |
| return function(input, start) { | |
| if (input) { | |
| start = +start; // parse to int | |
| return input.slice(start); | |
| } | |
| return []; | |
| } | |
| }); |
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
| <!DOCTYPE HTML> | |
| <html lang="en" ng-app="myApp"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Dynamic Pagination w/ Filtering</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta name="description" content=""> | |
| <meta name="author" content="Kim Maida"> | |
| <!-- JS Libraries --> |
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
| function getviewport() { | |
| var win = window, | |
| matchMediaSupported = (win.matchMedia || win.msMatchMedia), | |
| viewport; | |
| if (matchMediaSupported) { | |
| if (win.matchMedia('screen and (min-width: 641px)').matches) { | |
| viewport = 'large'; | |
| } else { | |
| viewport = 'small'; |