为了账号安全,请及时绑定邮箱和手机立即绑定

尝试访问指令中的数据时,AngularJs 崩溃

尝试访问指令中的数据时,AngularJs 崩溃

Go
慕码人2483693 2021-10-25 18:18:49
所以我是 Angular 的新手并试图做一个应用程序。我的服务器非常基础并且是用 go 编写的。这是我的角度代码-(function() {    var app = angular.module('dashboard', []);    app.controller("JobsController", function() {        this.currentJob = 0;        this.jobs = jobs;        this.setCurrentJob = function(index) {            this.currentJob = index;         };          });    var jobs = [        {            'id': 1,            'requester': 'Prakash Sanker',            'description': 'I want you to give me the entire world'        },        {            'id': 2,            'requester': 'MJ Watson',            'description': 'Please give me Spiderman, preferably upside down...but Im not fussy'        },        {   'id': 3,            'requester': 'Josh Lyman',            'description': 'Matthew Santos as president...or Jed Bartlet..but please not anyone Republican'        },         {            'id': 4,            'requester': 'Barry Allen',            'description': 'A frictionless suit that wont burst into flames when I run at a zillion miles an hour...its for a friend'        },        {            'id': 5,            'requeter': 'A. Bambaata',            'description': 'Boombox, prime condition, from the 80s. Go back in time if you have to'        }    ];})();这是我的 index.html -<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script><script type="text/javascript" src="/dashboard.js"></script><body>    <div class="dashboard">        <div ng-controller="JobsController as jobsCtrl">            <div class="jobs">                {{jobsCtrl.jobs[0]}}            </div>        </div>    </div></body>为什么会这样?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 154 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信