4 ms·
While learning Angular, it pays to really understand how the $scope works, when $watch'es are fired, and when you need to explicitly call an $apply, etc. What a
by taybul 13y ago
While learning Angular, it pays to really understand how the $scope works, when $watch'es are fired, and when you need to explicitly call an $apply, etc. What are some examples where things just don't work? While I was learning angular, a lot of times I had assumed things were available in scope when they were not. Some built-in directives like ng-repeat will create local copies of scope so I would try to change a variable directly expecting the parent to pick it up but it won't. Now my issues are simply misuse of the APIs. Eventually you will "get" the way angular works and instinctively know how to write with it.
- throwaway1979 13y agoThx for the kind words of encouragement. There is something elegant about angular and I'm going to keep slogging on. I think you're spot on about mechanisms .. I don't grok how angular does its magic and I think that is a big problem for me. Any suggestion on how one goes about learning Angular internals sans looking at the source code? I used Angular for two hackathons so far and didn't keep track of what didn't work. It was just a matter of ... let me try something a different way ... and poof ... it worked. Not very scientific I'm afraid.
- grogs 13y agoInstall Batarang for debugging scope issues. Don't be afraid of looking at the source, it's a great way to learn. Write some directives and then look at the ones provided by angular - and realise they're not cryptic.
- thisone 13y agoRe showing when things don't work. That's the best part of the egghead videos; showing things broken. I forget sometimes how much you learn from doing it wrong before doing it right.