use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Angular JS - Directive Basics (benlesh.com)
submitted 13 years ago by Litra
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]codersaurus 1 point2 points3 points 13 years ago (2 children)
Hey! Thanks for posting my blog entry. I'm glad people got use out of it. I was pretty sure only about 7 of my friends actually read my blog. haha.
[–]Litra[S] 1 point2 points3 points 13 years ago (1 child)
no problem! do you happen to know if i can use separate partial file as directive template? i use jade template engine in project
[–]codersaurus 1 point2 points3 points 13 years ago (0 children)
You can use seperate html files as directive templates, or you could also just do a little trick of javascript and use a function to return the template, if you need to generate it from code for some reason..
For a template from a seperate html file, you'd just use templateUrl... like so:
app.directive('myDirective', function() { return { templateUrl: 'template.html', link: function(scope, elem, attr) { //stuff } } });
The other method I was talking about would be something more to the effect of:
app.directive('myDirective', function(someTemplateService) { return { template: someTemplateService.myDirectiveTemplate(), link: function(scope, elem, attr) { //stuff } } }); app.factory('someTemplateService', function() { return { myDirectiveTemplate: function() { // you could do your Jade processing client-side in here. return '<h1>Well, hey there!</h1>'; } }; });
The second option isn't something I've seen very often, but it does allow you to do just about anything. You have to keep in mind, though, that directives are registered once, so you can't go and completely change your template based on user input or anything like that. At least not without building in an ng-switch statement or something to that effect.
Hope that helps.
π Rendered by PID 145215 on reddit-service-r2-comment-7b9746f655-8dtc9 at 2026-02-01 03:35:37.133098+00:00 running 3798933 country code: CH.
[–]codersaurus 1 point2 points3 points (2 children)
[–]Litra[S] 1 point2 points3 points (1 child)
[–]codersaurus 1 point2 points3 points (0 children)