testing
This file contains 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
ngApp.directive("cornify", function () { | |
return { | |
link: function (scope, element, attrs) { | |
var konami_keys = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]; | |
var konami_index = 0; | |
$(document).keydown(function(e){ | |
if (e.keyCode === konami_keys[konami_index++]) { | |
if (konami_index === konami_keys.length) { | |
$(document).unbind('keydown', arguments.callee); | |
$.getScript('http://www.cornify.com/js/cornify.js',function(){ |
This file contains 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
ngView.directive('myModal', function() { // in the template, the 'container' of your modal would have my-modal as an attribute | |
return { | |
scope: true, | |
link: function(scope, element, attrs) { | |
$(element).modal({show:false, backdrop:true, keyboard:true }); // this is instantiating a bootstrap modal i think | |
scope.$on('showModal', function (eventObj, record) { | |
scope.record = record; // refer to properties in the template like {{record.property}} |
This file contains 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
// normally the ServiceObject would just be assigned to the service injected into the controller | |
$scope.ServiceObject = { | |
property1:null, | |
property2:null | |
}; | |
// or it could be done this way | |
$scope.property1 = ServiceObject.property1; |
This file contains 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
authRouteProvider.$inject = ['$routeProvider']; | |
function authRouteProvider ($routeProvider) { | |
/** | |
* Creates a controller bound to the route, or wraps the controller in param | |
* so the authentication check is run before the original controller is executed | |
* @param currentController | |
* @return {Function} The wrapper controller | |
*/ | |
function redirectCtrlFactory (currentController) { | |
_ctrl.$inject = ['currentUser__', 'userRole__', '$location']; |