Pete Bacon Darwin
(Closed Source proprietary API)
(Comic by Nina Paley / CC By-SA 3.0)
In the five years that Angular.js has been around:
more than 1200 contributors
By Nevit Dilmen (Own work) [CC BY-SA 3.0]
https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md
Analyse the bug
Post an issue
Fix the problem
Submit the fix
Deal with feedback
Bask in the glory of being a super hero contributor
ngOptions incorrectly evaluates label for $$hashKey when watching labels
1.3.x ngCookies service overwrites/duplicates cookies set outside of ngCookies
https://github.com/angular/angular.js/issues/11490
AngularJS is throwing "TypeError: Cannot read property 'childNodes' of undefined" when using DOM elements that trigger directives in ng-view
git clone https://github.com/USERNAME/angular.js
npm install
npm install -g grunt
git checkout -b select-label-watch-bug v1.4.0
grunt package
grunt autotest
it('should not watch array properties that start with $ or $$', function() {
createSelect({
'ng-options': 'value as createLabel(value) for value in array',
'ng-model': 'selected'
});
scope.createLabel = jasmine.createSpy()
.andCallFake(function(value) { return value; });
scope.array = ['a', 'b', 'c'];
scope.array.$$private = 'do not watch';
scope.array.$property = 'do not watch';
scope.selected = 'b';
scope.$digest();
expect(scope.createLabel).toHaveBeenCalledWith('a');
expect(scope.createLabel).toHaveBeenCalledWith('b');
expect(scope.createLabel).toHaveBeenCalledWith('c');
expect(scope.createLabel).not.toHaveBeenCalledWith('do not watch');
});
Object.keys(values).forEach(function getWatchable(key) {
if (key.charAt(0) === '$') return;
var locals = getLocals(values[key], key);
var selectValue = getTrackByValueFn(values[key], locals);
watchedArray.push(selectValue);
// Only need to watch the displayFn if there is a specific label expression
if (match[2] || match[1]) {
var label = displayFn(scope, locals);
watchedArray.push(label);
}
// Only need to watch the disableWhenFn if there is a specific disable expression
if (match[4]) {
var disableWhen = disableWhenFn(scope, locals);
watchedArray.push(disableWhen);
}
});
grunt build
cp build/angular.js myApp
grunt test
This is equivalent to
grunt jshint grunt jscs grunt package grunt test:unit grunt test:promises-aplus grunt tests:docs grunt test:protractor
Sign the CLA
https://cla.developers.google.com/about/google-individual?csw=1
Write a good commit message
Push to your fork
Create pull request
Check solution passes on Travis
fix(ngOptions): do not watch properties starting with $
Expressions that compute labels and track by values for ngOptions were being called for properties, that start with $ even though those properties were being ignored as options.
Closes #11930
Push to your fork
git push -u origin/select-label-watch-bug
Deal with comments and suggestions
Add new commits (no need to squash or force push)
Sit back and bask in contribution glory
Bonus Points:
Watch for related regressions appearing in issues
Get in touch
https://github.com/petebacondarwin
Slide deck:
https://slides.com/petebd/a-day-in-the-life-of-a-bug
Other useful links: