Angularjs 图像未使用iamgeurl显示?

Angularjs 图像未使用iamgeurl显示?,angularjs,Angularjs,这是我的密码 location: { address: 'Google Headquarters', city: 'Mountain View', province: 'CA' }, imageUrl: "img/angularjs-logo.png", sessions: [ { name: 'Directives Masterclass', creato

这是我的密码

  location: {
        address: 'Google Headquarters',
        city: 'Mountain View',
        province: 'CA'
    },
    imageUrl: "img/angularjs-logo.png",
    sessions: [
        {
            name: 'Directives Masterclass',
            creatorName: 'Bob Smith',
            duration: '1 hr',
            level: 'Advanced',
            abstract: 'In this sesison you will learn the ins and outs of directives!',
            upVoteCount: 0
        },
图像未显示,这是conroller.js,我使用AngularJS v1.2.10

  <div ng-controller="EventController" style="padding-left:20px; padding-right:20px">
        <img ng-src="{{event.imageUrl}}" alt="{{event.name}}" />

也许有不同的方式来表现它,我没有得到一个错误。我在网上看到了一个toturial,它也是这样做的。

有人能告诉我我做错了什么吗?

您应该在控制器的作用域中使用事件变量,以使其正常工作:

您的控制器:

app.controller('MainCtrl', function($scope) {

  $scope.event = { location: {
        address: 'Google Headquarters',
        city: 'Mountain View',
        province: 'CA'
    },
    title: "some title",
    imageUrl: "http://plnkr.co/img/plunker.png",
    sessions: [
        {
            name: 'Directives Masterclass',
            creatorName: 'Bob Smith',
            duration: '1 hr',
            level: 'Advanced',
            abstract: 'In this sesison you will learn the ins and outs of directives!',
            upVoteCount: 0
        },
    ]};


});
您的html:

<body ng-controller="MainCtrl">
  <p><img ng-src="{{event.imageUrl}}" title="{{event.title}}" /></p>
</body>


您能再添加一点行为吗?你是怎么写你的标记的?@maurizio,我已经编辑了一个plunker来向你展示:谢谢,我做标记的方式和以前一样吗?因为我在看教程,所以我所做的没有什么不同