Hi,
I have 2 directives, directive tl-timeline-main containing a controller and
tl-scrollable. tl-scrollable requires tlTimelineMain's controller via
requires but I get the above error message. I am in the dark as to why the
controller can't be found...
The requesting directive contains require:'tlTimelineMain' in the
returnvalues;
the directive that is _being_ requested - tlTimelineMain'- returns the
controller in it's return values
If I remove the requires line, everything works - except I have no access
to the controller..
I do not know what else I need to do to make this work. Someone else?
this is included in index.html -->
<div id="container">
<div class="timeline"
id="timeline"
ng-controller="Main"
tl-timeline-main <<<<=== [1] this directive is requested
=====================
min="1500"
max="2010"
step="50">
<ol class="years"
tl-years>
<li class="year"
tl-year
ng-repeat="year in years"
ng-style="{left: year.x + 'px'}">
{{year.year}}
</li>
</ol>
<div tl-edit-links></div>
</div>
<div class="scrollbar" tl-scrollable> <<<<=== [2] this directive is
requesting ================
</div>
[2]
<!-- tl-scrollable.js -->
(function(ng,app){
app.directive('tlScrollable',function(){
function link(scope,element,attrs,tlController){
var windowWidth = $(window).width();
var threshold, leftThreshold = 450;
var rightThreshold = windowWidth - threshold;
// set element weight == window weight
element.css({
'width': windowWidth
});
// reset element weight on window resize
$(window).resize(function(){
element.css({
'width': windowWidth
});
});
function handleMouseover(e){
}
element.on('mouseover',handleMouseover);
}
return({
link: link,
restrict: 'A',
require:'tlTimelineMain'
});
})
})(angular,timelineApp);
[1]
<!-- tlTimelineMain -->
(function(ng,app){
app.directive('tlTimelineMain',function(){
function Controller($scope){
var listeners = [];
function addListener(subscriber){
listeners.push(subscriber)
}
function scrollTimeline(step){
}
return({
scrollTimeline: scrollTimeline,
addListener: addListener
});
}
function link(scope,element,attrs){
this.attrs = attrs;
startYear = parseFloat(attrs.min);
endYear = parseFloat(attrs.max);
yearStep = parseFloat(attrs.step);
tlWidth = element.width();
pixelsPerYear = tlWidth / (endYear - startYear)
nrOfSteps = Math.floor((endYear - startYear) / yearStep);
for(var i=0; i<nrOfSteps; i+=1){
scope.years.push({
year: startYear + (i * yearStep),
x: ((i+1)*attrs.step) * pixelsPerYear
});
}
}
return({
controller: Controller,
restrict: 'A',
link: link
});
});
})(angular,timelineApp);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.