Skip to content

Instantly share code, notes, and snippets.

View evangalen's full-sized avatar

Emil van Galen evangalen

View GitHub Profile
@evangalen
evangalen / add-article.controller.js
Created April 23, 2016 10:46
Angular 1.0 - Simple Reddit
(function() { 'use strict';
angular
.module('app')
.controller('RedditAddArticleController', RedditAddArticleController)
/**
* @constructor
* @param $scope dependency injected child scope for this controller
@evangalen
evangalen / angularjs_directive_attribute_explanation.md
Created April 12, 2016 06:42 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@evangalen
evangalen / index.html
Last active August 29, 2015 14:15 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://cdn.rawgit.com/babel/babel.github.io/master/scripts/babel.js"></script>
</head>
<body>
<script id="jsbin-javascript" type="text/babel">class A {};</script></body>
@evangalen
evangalen / app.js
Last active December 23, 2015 18:19
Plunk demonstrating AngularJS issue #1412 (= "input not showing invalid model values")
angular.module('plunker', []);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:19
Plunk demonstrating a fix for AngularJS issue #1412 (= "input not showing invalid model values") as well a fix 2 inconsistencies in the parsing of data entry.
angular.module('plunker', ['jdFixInvalidValueFormatting', 'jdFixParsingInconsistencies']);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:18
Plunk demonstrating a fix to render invalid values in a <input/> element; this effectively fixes AngularJS issue #1412 (= "input not showing invalid model values")
angular.module('plunker', ['jdFixInvalidValueFormatting']);
@evangalen
evangalen / app.js
Last active December 23, 2015 18:09
Plunk using the custom "jdOnlyLetters" directive that does show invalid valid (as opposed to: ng-pattern="/^[a-zA-Z]*$/")
angular.module('plunker', ['jdOnlyLetters']);
window.onerror = function(errorMsg, url, lineNumber) {
var text = document.documentElement.innerHTML;
var lines = text.match(/^.*((\r\n|\n|\r)|$)/gm);
var windowOnLoadLineNumber = null;
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.indexOf('window.onload') === 0) {
@evangalen
evangalen / $resource-with-default-update-action.js
Last active December 15, 2015 02:59
AngularJS module "ngResourceWithDefaultUpdateAction" which add a default "update" action to every $resource.
angular.module('$resource-with-update-action', ['ngResource'], function($provide) {
$provide.decorator('$resource', function($delegate) {
var decoratedResourceFactory = function(url, paramDefaults, actions) {
var actionsWithDefaultUpdateAction =
angular.extend({}, { 'update': { method:'PUT' } }, actions);
return $delegate(url, paramDefaults, actionsWithDefaultUpdateAction);
};
@evangalen
evangalen / app.js
Created March 3, 2013 18:49
AngularJS Starter with Jasmine unit testing integrated (for usage in "http://plnkr.co/")
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});