How do I make the html attribute's value dependent on the item being rendered by an Ember.js view?

Let's say I have a view like so:

App.AnchorView = Ember.View.extend({
  tagName: 'a',
  attributeBindings: ['href']

and a class definition:

App.Item = Ember.Object.extend({
  name: "Unknown Entry",
  location: ""

and an instance of the class:

   name: "Google",
   location: "" 

and my template is:

{{#view App.AnchorView}}{{name}}{{/view}}

and I want it to render as:

<a href="">Google</a>

How do I do that?


Here's a super quick way to do it using bindAttr href and an ItemsController: For more detailed documentation check out

{{#each App.ItemsController}}
     <a {{bindAttr href="location"}}>{{name}}</a>

App.ItemsController = Ember.ArrayController.create({
     content: [
         App.Item.create({ name: "Google", location: ""})

Need Your Help

File Scope and Global Scope: C & C++

c++ c scope global-scope

I am a student and I am confused about global and file scope variables in C and C++.