Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript angularjs加载所有内容后评估angularjs ng单击参数_Javascript_Angularjs - Fatal编程技术网

Javascript angularjs加载所有内容后评估angularjs ng单击参数

Javascript angularjs加载所有内容后评估angularjs ng单击参数,javascript,angularjs,Javascript,Angularjs,我有一个简单的翡翠标记: .well(ng-repeat="note in notes") .row h3.pull-left {{note.title}} p.pull-right ( {{note.subject}}, {{note.college}} ) .row.margin-bottom-10(style="border-bottom: 1px solid #000")

我有一个简单的翡翠标记:

.well(ng-repeat="note in notes")
            .row
                h3.pull-left {{note.title}}
                p.pull-right ( {{note.subject}}, {{note.college}} )
            .row.margin-bottom-10(style="border-bottom: 1px solid #000")
                p.pull-left Author: {{note.author}}
                p.pull-right Uploaded by: {{note.uploader}}
            .row
                p.
                    {{note.description}}
            .row
                button.btn.btn-default.pull-left(ng-click="download('{{note.noteId}}','all')") Download
                button.btn.btn-default.pull-right Details
现在,在我的网站中,它被转换为以下html-

<div ng-repeat="note in notes" class="well ng-scope">
   <div class="row">
      <h3 class="pull-left ng-binding">test</h3>
      <p class="pull-right ng-binding">( test, MSRIT )</p></div>
   <div style="border-bottom: 1px solid #000" class="row margin-bottom-10">
      <p class="pull-left ng-binding">Author: test</p>
      <p class="pull-right ng-binding">Uploaded by: harshitladdha93@gmail.com</p></div>      
   <div class="row">
      <p class="ng-binding">test</p></div>
   <div class="row">
      <button ng-click="download('5f4815f2-73a9-4621-86ed-b4e302cc49ba','all')" class="btn btn-default pull-left">Download</button>
      <button class="btn btn-default pull-right">Details</button></div></div>
我明白了

/download/{{note.noteId}}/all
即{note.noteId}},而不是angular处理的值
如何修复此问题

从jade模板中移除环绕note.noteId的花括号{{},以使其正常工作:

button.btn.btn-default.pull-left(ng-click="download(note.noteId,'all')") Download

不,在这种情况下,我甚至没有在html中获取noteId值,只有note.noteId以html打印,控制器也会这样做,我的ng click看起来像:data ng click=downloadnote,我在我的控制器中的download函数中获取note作为对象您的html标记应该像这样工作。注释:注释在角度范围内,对吗?是的,注释在角度范围内,这就是检索所有其他值的方式。但由于某些原因,我确实在调用函数中看到了url,但在控制器中没有看到该url,我的最佳猜测是控制器在计算note.noteId之前正在加载该函数。出于某些原因,它不应该在html中解码note.noteId,而应该是downloadnote.noteId,html标记中的“all”,以便Angular可以使用范围绑定对其进行计算。
button.btn.btn-default.pull-left(ng-click="download(note.noteId,'all')") Download