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

  • SEARCH
  • Home
  • 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 8606315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:03:44+00:00 2026-06-12T03:03:44+00:00

For example, I have a script like this, which defines a new div, annotated

  • 0

For example, I have a script like this, which defines a new div, annotated with a page number

<script type="text/x-handlebars" data-template-name="page-template">
    <div class = 'page'>
       The page is  <b>{{ App.pageView_1.pageNumber }}</b>
    <div>
</script>

The corresponding view:

App.pageView_1 = App.PageView.create({
    templateName: 'page-template',
    pageNumber: 1,
})

And I want to dynamically declare new views, each one with a different pageNumber field and view name, so:

  App.pageView_2 = App.PageView.create({
      pageNumber: 2,
  });

  App.pageView_3 = App.PageView.create({
      pageNumber: 3,
  });

note the templateName field has been omitted for clarity.

The problem is the param within the template block has to change to {{ App.pageView_2.pageNumber }} and so on.

Any idea how this could be done?

  • 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-12T03:03:45+00:00Added an answer on June 12, 2026 at 3:03 am

    A bit closer to the ember way:

    {{#each App.pagesController}}
        {{#view App.PageView contextBinding="this"}}
            {{pageNumber}}
        {{/view}}
    {{/each}}
    

    And for the controller:

    App.pagesController = Em.ArrayController.create({
        content: [{ pageNumber: 1 }, { pageNumber: 2 }, { pageNumber: 3 }]
    });
    

    By the way, you probably want the templateName to be set when the view is originally defined.

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

Sidebar

Related Questions

I am trying to have a custom URL which looks like this: example.com/site/yahoo.com which
I have a bash script mystuff containing a line like lynx -dump http://example.com >tmpfile
i have a script which take hh:mm:ss inputs for example vid_cut.py -t 00:00:30 00:10:00
I have a script which allows to display favicons based on the url: Example
If I for example have <p> some long text </p> on my HTML page,
I have a little web app that uses the Facebook like widget. This page
I have a working script like this: jQuery(document).ready(function(){ $('.video-thumb img').bind('mouseover',function(){ var new = $(this).attr('src').replace(/default.jpg/,'1.jpg');
I have outbound links like this in my html: <a href=http://www.example.com class=gaLink1 target=_blank onCLick=ga_track_link('action',
for example I have a script that needs to put it's parent directory on
I have that script: // ==UserScript== // @name example // @include http://xxx* // @require

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.