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

Seth Warner
Seth Warner
1,878 Points

If you set up two scopes for the same controller inside the same view..

Would something like this work? I'm trying to get the anchor tag to show along with the html.

<div ng-controller="sameControllerName">
     <a href="#" ng-click="!coverLetter = coverLetter"></a>
     <p ng-bind-html ng-show="coverLetter" ></p>

</div>

<div ng-controller="sameControllerName">
<a href="http://www.google.com/" ng-show="coverLetter"> Google </a>
</div>

Seth Kroger Kevin Korte jason chan

2 Answers

Steven Parker
Steven Parker
229,644 Points

Sure, that should work. But why not try a little experiment to test it for yourself?

Seth Warner
Seth Warner
1,878 Points

Steven Parker well I did, but for some reason It's not working. I just wanted to confirm it was okay to do that with controllers, another words it could technically work. Guess that means theres something with my Sass causing it to error out.

Steven Parker
Steven Parker
229,644 Points

Oops, I was just looking at the two ng-show's. I'm not sure about the two controller references.

Is there a larger container that holds both of these you could attach the controller to?

Seth Warner
Seth Warner
1,878 Points

Steven Parker You gave me an idea! Thank you, I just had to flip a few div's around in order to get it to work.

  • Seth
Steven Parker
Steven Parker
229,644 Points

Excellent. Glad it worked.