Could you tell the difference between these four?
$scope.$watch('foo', fn)
$scope.$watch(function() {return $scope.foo}, fn)
$scope.$watch(obj.prop, fn)
$scope.$watch(function() {return obj.prop}, fn)
Could you tell the difference between these four?
$scope.$watch('foo', fn)
$scope.$watch(function() {return $scope.foo}, fn)
$scope.$watch(obj.prop, fn)
$scope.$watch(function() {return obj.prop}, fn)
$(document)
. Other firing of events would depend on the $emit
of scope events.click-elsewhere="show=false"
, and click-elsewhere="fn()"
, thanks to $parse
.I was thinking about it: what purpose should a blog serve?
Have this list firmly registered somewhere in the back of your head before embarking on Angular! I can’t tell you how much confusion and pain not realising its existence has caused me. These are the keywords I used to find all the directives that create scope, thanks to @sp00m’s prompt.
Providing that Angular’s documentation is consistent in the way they describe directives, which it seems to be, below is the full list of results, in order of priority level of execution:
terminal
$ sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /bin/subl
vimrc
map <silent><leader>os : exe 'silent !subl .'<CR>
The most important thing is of course to find something that works for you. The other thing is that, as its creator Miško puts it, once you structure it in a particular way, and other people structure it the same way, it makes it easier for you to leap from one project to another.
Since I constantly need to use jQuery together with TweenMax and since TweenMax already took care of all the parsing of various types of transformation strings as well as compatibility issues, I wrote a tiny jquery plugin here (more of a wrap up of gsap’s) that could directly access these values like this:
$('#ele').transform('rotationX') // returns 0
$('#ele').transform('x') // returns value of translate-x
Summary: UpperCamelCase for Controllers and constructor Services, lowerCamelCase everywhere else.
I was trying to figure out a way to enumerate through properties of Math object when I realise that I can’t access any. Whaaat? Why?