Full-text search for your Twitter archive (Go + AngularJS + PostgreSQL)
paulsmith.github.com
paulsmith.github.com
Oh well, it seems like a simple example of a Go server, can anyone speak to the code quality?
I'll say the angularJS isn't so great. No tests are implemented, and only rudimentary behavior is used.
Op you should use ng-change rather than a watch. those watch's are irritatingly undependable.
ng-change is an event triggering when the input element changes.
watches can fire multiple times (I think up to 10), if the result of one watch changes the model, then angular will run all the checks again.
watches have their place on custom directives, but they're otherwise a pain in the butt.
I THINK this is how it works. I can tell you this with certainty: ng-change and $watch behave very differently.
var ngChangeDirective = valueFn({
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
ctrl.$viewChangeListeners.push(function() {
scope.$eval(attr.ngChange);
});
}
});It triggers on the $setViewValue event. Not on detecting a model change event, like $watch. They are not the same.