ng-switch - Error: Argument '?' is required at assertArg

464 views
Skip to first unread message

Jamie @GotNoSugarBaby

unread,
Jan 26, 2013, 8:49:11 AM1/26/13
to ang...@googlegroups.com
Hi guys,
I'm having some trouble implementing ng-switch and would appreciate some help if anyone is willing. I've read http://docs.angularjs.org/api/ng.directive:ngSwitch and tried to debug it myself by setting a breakpoint at http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:973:11 then climbing the stack trace, but I can't see what I'm missing.

The problem can be seen in isolation at http://jsfiddle.net/txEwf.

Thanks for your time,

Jamie

Jamie @GotNoSugarBaby

unread,
Jan 26, 2013, 8:50:19 AM1/26/13
to ang...@googlegroups.com

Pawel Kozlowski

unread,
Jan 26, 2013, 9:00:34 AM1/26/13
to ang...@googlegroups.com
Hi!

The problem in your fiddle was that HTML tags (div) were not closed
correctly. AngularJS uses live DOM as a base for its "templates" so
invalid DOM will result in invalid behavior. Here is a fixed jsFiddle:
http://jsfiddle.net/MRVH5/

BTW: your fiddle was more complex than necessary, please check this
post on how to use jsFiddle effectively:
http://pkozlowskios.wordpress.com/2012/08/12/using-jsfiddle-with-angularjs/

Or just switch to plunker....

Hope this helps,
Pawel
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular?hl=en-US.
>
>



--
Question? Send a fiddle
(http://jsfiddle.net/pkozlowski_opensource/Q2NpJ/) or a plunk
(http://plnkr.co/)
Need help with jsFiddle? Check this:
http://pkozlowskios.wordpress.com/2012/08/12/using-jsfiddle-with-angularjs/

Looking for UI widget library for AngularJS? Here you go:
http://angular-ui.github.com/

Jamie @GotNoSugarBaby

unread,
Jan 26, 2013, 9:05:58 AM1/26/13
to ang...@googlegroups.com
man I can't believe I couldn't spot that - damn. Thanks a lot Pawel I appreciate that, also the info on Plunker which I hadn't heard of.
Reply all
Reply to author
Forward
0 new messages