A canjs Control that setup Google Analytics (injects JS) and can automatically:
- track hashChange (on or off) as pageView
- track any can.Model / Observe / Model.List / Observe.List events as Google Analytics events
/* | |
* requirejs plugin that loads mustache templates from the baseUrl and registers it in can.view | |
* Optimize/compiles/minifies the templates when the requirejs optimizer is run | |
* usage: | |
* require([ | |
.., | |
'mustl!path/to/mustache/tmp.mustache' // no need to add a var in callback function for your template | |
], function () {}) | |
*/ |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
can.Model.List.prototype.filter = function(cb) { | |
var res = []; | |
debugger; | |
this.each(function(amodel, pos, models) { | |
var ares = cb.call(amodel, pos, models); | |
if (ares === true) {res.push(amodel)} | |
}); | |
return res | |
} |