Closed guillaumewuip closed 9 years ago
Looks beautiful!
@guillaumewuip I am trying to learn angular. Where do you use the partials/logs.html? How do you set the variables that get filled into the template? Especially the index
variable.
https://github.com/bluejamesbond/Scribe.js/blob/a2e079c7e4784f0cb9c95caec17382a3e2c76c7e/static/partials/logs.html#L11
In angular, app.js
generally says all lot of thing.
We can see that the log viewer is the controller logsController
that use the template partials/logs.html
.
Let's open this template :
<log
ng-repeat="line in lines | orderBy : order : reverse | filter : search track by $index"
log="line"
number="$index"
show-file="showFile"
show-time="showTime"
show-date="showDate"
show-tags="showTags"
></log>
Here we call the log
directive with the $index
variable you mention.
So, next, open the log directive js/directives/log.js
where we see it use the template partials/elements/log.html
and here we are, we found where index
is printed.
By convention, I put all directives templates in partials/elements/
as there're not full-page templates.
@guillaumewuip i see but where does it say something like: logPartialTemplate.fillWith(logEntryObj)
(<-- that is only psuedocode)
Angular does it by itself.
In patials/logs.html
you pass the log object to the directive :
<log log="myLogObject" ... </log>
So in the directive log.js, as you have scope.log = "="
, angular attach myLogObject to the scope of the directive and then load the directive template we've configure line 69 of the directive with templateUrl : 'partials/elements/log.html'
. And, by itself, it fill the directive template with its scope.
I hope I'm clear
@guillaumewuip That makes sense thanks! Also, I just wanted to inform you that I think we are ready to push to npm
. Not sure how to do this. I think we may have to add tests. Just let me know. Also I will be breaking down the README into the wiki soon
You're welcome !
Ok for npm
, I don't really know to do this too ahah. I once published a package on npm, I never had to add tests.
Maybe I'll have some time these days to help you with the wiki.
btw, awesome heroku demo app !
Ill work on the wiki sometime tomorrow and push into npm
tomorrow hopefully. And thanks!
Is it ok for you @bluejamesbond ?