Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AngularJS Making Your Own Widget Wiring the Widget

Seemingly incorrect example of ng-style based on latest versions of Angular 1.x in quiz

The following question has incorrect use of ng-style: "Suppose I want to set the width and height of an element to two dynamic properties: โ€˜myWidthโ€™ and โ€˜myHeightโ€™, respectively. What syntax would I use to accomplish that?

A: <div ng-style="width = {{myWidth}}; height = {{myHeight}};">...</div>

B: <div ng-style="{width: myWidth; height: myHeight}">...</div>

C:  <div ng-width="myWidth" ng-height="myHeight">...</div>

D: <div width="{{myWidth}}" height="myHeight">...</div>

The correct answer amongst the options I picked, B, is technically incorrect since multiple properties should be separated by a comma not a semicolon.

I also tried the example with the correction I suspected w/ Plunker, what the AngularDocs uses for examples, with no problems.

On the other-hand, option B as is doesn't work. Perhaps this can be corrected before a complete Angular newbie goes astray if I'm correct?

P.S.: Also other questions in this quiz to review the sources the questions only go to the build your widget wrap up video (1.25 minutes) by Alex Vanston . That doesn't seem intentional.

Starting the majority of the vids 10+ days ago, this seemingly can be disorientating towards completion of the course.

Edit: The actual code snippets are being truncated; users can no longer use code blocks within the forums?

1 Answer

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Thanks Kevin.

I fixed code block to be displayed properly and am looking into the issue you raised about the quiz.

Thank you for the help! I have changed the quiz to use commas as you are right. That should be JSON which uses commas to separate values.