<script type="text/discourse-plugin"
version="0.8">
const testComponent = require('discourse/app/raw-views/list/posts-count-column').default;
testComponent.reopen({
user: function() {
return Discourse.User.current()
}.property()
});
</script>
I tried to use repoen()
on the posts-count-column
component to pass currentUser value as the example below but got an error, I think maybe only a limited type of component support this method?
And I find another way to pass the currentUser value into a nested hbr, by overwrite from top to bottom, add {{raw “list/posts-count-column” topic=topic tagName=“div” user=user}} to insert the value
<script type='text/x-handlebars' data-template-name='mobile/list/topic-list-item.raw’>
<script type='text/x-handlebars' data-template-name='list/post-count-or-badges.hbr'
<script type="text/x-handlebars" data-template-name="list/posts-count-column.hbr">
Does emberjs have a provide/inject function like vue for passing value into a nested template? I did some search but didn’t find much info. Any suggestion on this?