ng-submit
* only makes sense on a<form>
tag * is just an event handler much likeng-click
ng-options
* only makes sense on a<select>
tag * enables us to have objects as selected values instead of just strings * saves us from having to type out<options ng-repeat="..." ... />
* provides additional shortcut for<optgroup>
through:groupBy
ng-click
- should always be a method call, don't do assignments as that relies on brittle scoping and is hard to test
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
Drupal.verticalTabs = Drupal.verticalTabs || {}; | |
Drupal.settings.verticalTabs = Drupal.settings.verticalTabs || {}; | |
Drupal.behaviors.verticalTabs = function() { | |
if (!$('.vertical-tabs-list').size() && Drupal.settings.verticalTabs) { | |
var TABSETTING = "tabpos"+document.location.pathname.replace(/\//g,666); | |
var ul = $('<ul class="vertical-tabs-list"></ul>'); | |
var panes = $('<div class="vertical-tabs-panes"></div>'); | |
$.each(Drupal.settings.verticalTabs, function(k, v) { | |
var summary = '', cssClass = 'vertical-tabs-list-' + k; |
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
javascript:(function(){var e={},t,n={},r=(prompt("Ignore filter (comma sep)?","")||"").split(","),i=r.length,s=document.createElement("iframe"),o="";while(i--){n[r[i]]=1}for(i in window){if(window[i]!==undefined){e[i]={type:typeof window[i],val:window[i]}}}s.style.display="none";document.body.appendChild(s);s.src="about:blank";s=s.contentWindow||s.contentDocument;for(i in e){if(typeof s[i]!="undefined")delete e[i];else if(n[e[i].type])delete e[i]}t="addEventListener,document,location,navigator,window".split(",");i=t.length;while(--i){delete e[t[i]]}var u=[];for(i in e){u.push(i)}alert(u.length?"Found these globals: "+u.join(", ")+". See details in the console!":"No globals found!");console.dir(e)})() |
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
txticon = function(iconname) { | |
var map = { | |
"glass": "E001", | |
"leaf": "E002", | |
"dog": "1F415", | |
"user": "E004", | |
"girl": "1F467", | |
"car": "E006", | |
"user_add": "E007", | |
"user_remove": "E008", |
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
angular.module('myApp',[]) | |
.factory('tags',function(){ | |
var tags = ['urgent','blocked','boring','hard'], | |
callbacks = []; | |
return { | |
addTag: function(t){ | |
tags.push(t); | |
callbacks.forEach(function(cb){ | |
cb(tags) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Exercise 1</title> | |
<script src="../jquery.js"></script> | |
<script src="../angular.js"></script> | |
<style> | |
.selected { | |
text-decoration: line-through; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Exercise 1</title> | |
<style> | |
.done { | |
text-decoration: line-through; | |
} |
Say we have a database of users and roles, where each user belongs to a role. Using the denormalized Firebase approach I might store that like this:
{
"users": {
"abc123": {
"name": "Joe",
"role": "kkk333"
},
// lots more users
To create a container, I only need to add my AppState typings to the mapStateToProps
parameter:
const mapStateToProps = (state: State) => ({
messages: state.messaging.messages
});
const mapDispatchToProps = (dispatch) => ({
dismissUIMessage: (num) => dispatch(actions.dismissUIMessage(num))
});