Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:40:52+00:00 2026-06-06T22:40:52+00:00

I know i am doing something stupid but my backbone marionette app is giving

  • 0

I know i am doing something stupid but my backbone marionette app is giving me template errors that don’t make sense. It appears to be rendering a single item before the fetch event happens.

_.templateSettings = {
    interpolate: /\{\{(.+?)\}\}/g
};


MyApp = new Backbone.Marionette.Application();
MyApp.addRegions({
    TagsRegion: "#tagsHolder"
});



MyApp.NoItemsView = Backbone.Marionette.ItemView.extend({
    template: "#show-no-items-message-template"
});


MyApp.Tag = Backbone.Model.extend({

});
MyApp.TagCollection = Backbone.Collection.extend({
    model: MyApp.Tag,
    url: '/API/Tag'
});
MyApp.TagItemView = Backbone.Marionette.ItemView.extend({
    template: "#tag-template",
    tagName: 'li'
});


MyApp.TagCollectionView = Backbone.Marionette.CollectionView.extend({
    itemView: MyApp.TagItemView,
    emptyView: MyApp.NoItemsView,
    tagName: 'ul'
});


MyApp.addInitializer(function(options){
    var tagCollection = new MyApp.TagCollection({
    });
    var tagCollectionView = new MyApp.TagCollectionView({
        collection: tagCollection
    });

    tagCollection.fetch();
    MyApp.TagsRegion.show(tagCollectionView);
});

and my html page is

<div id="TagsDiv">
    <h1>Tags</h1>
    <div id="tagsHolder"></div>
</div>    
<script type="text/template" id="show-no-items-message-template">
    No items found.
</script>

<script type="text/template" id="tag-template">
    {{ TagName }}
</script>


    <script type="text/javascript" src="/Scripts/Views/Home/Upload.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            MyApp.start();
        });

If I remove the mustaches from my tag-template it displays 1: ” TagName ” then when the fetch completes it shows the right number.

if i put the mustaches back in i get “TagName is not defined”

I feel that i have one of my patterns backwards. I am just too close to see it.

Thanks
-Mark

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:40:54+00:00Added an answer on June 6, 2026 at 10:40 pm

    The problem is this line in your initializer

    var tagCollection = new MyApp.TagCollection({
        });
    

    When you pass an empty object literal in to a Backbone.Collection constructor, Backbone creates an empty model in the collection. To fix this, just remove the object literal:

    var tagCollection = new MyApp.TagCollection()

    and it won’t have the empty item in it anymore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing something stupid, but I don't know what it is, can someone point
I know I'm doing something stupid and probably obvious, but I'm not sure what.
i know im doing something stupid here but its been a few years since
I know I'm doing something stupid, but I cannot figure how to fix it.
I know this sounded stupid. But I gotta be doing something wrong here. Say,
I don't know what I'm doing wrong but I've been trying to get this
I'm new to JSF and I'm sure I'm doing something stupid, but I've been
I'm probably doing something stupid, but I can't spot it. I've installed Eclipse Helios
Please excuse me if I'm doing something really stupid, but I'm a little new
I know I have to be doing something just brain-dead stupid for this not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.