So, I've been banging my head against my keyboard for the past few hours trying to figure out how to turn this:
<scope-filter label="Sort by" type="sort">
<scope-filter-item key="recent">Recent Activity</scope-filter-item>
<scope-filter-item key="influence">Influence</scope-filter-item>
<scope-filter-item key="loyalty">Loyalty</scope-filter-item>
<scope-filter-item key="followers">Followers</scope-filter-item>
<scope-filter-item key="visits">Visits</scope-filter-item>
</scope-filter>
Into this:
<div>
<label>Sort By:</label>
<ul>
<li>Recent Activity</li>
<li>Influence</li>
<li>Loyalty</li>
<li>Followers</li>
<li>Visits</li>
</ul>
</div>
Using this: http://jsfiddle.net/qBnDF/14/
For some odd reason, scope-filter-item
entries are only being processed and associated with scope-filter
if I include <div ng-transclude></div>
within the scope-filter.html
template.
There are quite a few more things this directive is going to do, but to keep things simple, I'll just extract all the unnecessary stuff unrelated to the actual problem.
From what I've read about directives is that you should be able to pass a controller from the parent to the child by using the require: '^thingToRequire'
syntax. This then should inject the parent controller into the child controllers link
method.
Not really sure what's going on here. Sorry, I'm more of an angular novice at the moment and this is kind of voodoo / black magic to me.
Any help would be greatly appreciated!