Javascript AngularJS ng click函数,带有返回语法错误的AngularExpression参数

Javascript AngularJS ng click函数,带有返回语法错误的AngularExpression参数,javascript,angularjs,Javascript,Angularjs,我正在使用AngularJS框架制作一个notes web应用程序。。我正在成功显示笔记,我想使用唯一的\u id删除和更新笔记。。我试着使用单击时的a函数,在字体可怕的关闭图标中使用notes uid重复ng 代码如下: <div class="bodyContainer"> <div class="title"> <h3>Notes<i ng-click="updateFunc()" class="fa fa-refresh"

我正在使用AngularJS框架制作一个notes web应用程序。。我正在成功显示笔记,我想使用唯一的\u id删除和更新笔记。。我试着使用单击时的a函数,在字体可怕的关闭图标中使用notes uid重复ng

代码如下:

<div class="bodyContainer">
    <div class="title">
        <h3>Notes<i ng-click="updateFunc()" class="fa fa-refresh"></i></h3>
    </div>
    <div class="notesBox">
        <div class="notes" ng-repeat="Notes in txtArray | limitTo: 5">
            <remove-notes></remove-notes>
            <p class="notesTitle">{{Notes.notes_title}}</p>
            <p>{{Notes.notes_text}}</p>
        </div>
        <h3 class="emptyBox" ng-hide="txtArray.length > 0">Write Your First Note!!</h3>
    </div>
    <div class="homePaging"><a href="#notes">See more</a></div>
</div>

笔记

{{Notes.Notes\u title}

{{Notes.Notes_text}

写下你的第一张便条!!
以下是指令的指令代码:

diary.directive('removeNotes', function () {
return {
    restrict: 'E',
    template: '<i  class="fa fa-close fa-fw" ng-click="removeNote({{Notes.notes_uid}})">',
    link: function ($scope,element,attrs) {
        element.bind('click', function () {
            element.css('color','#19B5FE');
        })
    }
}
});
diary.directive('removeNotes',函数(){
返回{
限制:'E',
模板:“”,
链接:函数($scope,element,attrs){
元素绑定('单击',函数(){
css('color','#19B5FE');
})
}
}
});
但当我使用click事件处理程序单击图标时,它会给我一个解析错误:

当我检查控制台中的“元素”面板时。。它呈现ang表达式的值
{Notes.Notes\u uid}


有没有更好的方法来实现删除功能。。我只想知道如何以异步方式将注释传递到后端php代码。

当您使用Angular的内置指令
ng click时,需要删除表达式中的括号

template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(Notes.notes_uid)">'
然后在外部视图中,将模型绑定到
ng model
like

<remove-notes ng-model="Notes"></remove-notes>

在使用Angular的内置指令时,需要删除表达式中的括号

template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(Notes.notes_uid)">'
然后在外部视图中,将模型绑定到
ng model
like

<remove-notes ng-model="Notes"></remove-notes>

在使用Angular的内置指令时,需要删除表达式中的括号

template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(Notes.notes_uid)">'
然后在外部视图中,将模型绑定到
ng model
like

<remove-notes ng-model="Notes"></remove-notes>

在使用Angular的内置指令时,需要删除表达式中的括号

template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(Notes.notes_uid)">'
然后在外部视图中,将模型绑定到
ng model
like

<remove-notes ng-model="Notes"></remove-notes>

将此内容放入模板中:

<remove-notes notes="Notes"></remove-notes>

试试这个:

    diary.directive('removeNotes', function () {
  return {
      restrict: 'E',
      scope: {
        notes : "=notes"
      },
      controller: {
        // Define removeNote function here
      },
      template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(notes.notes_uid)">',
      link: function ($scope,element,attrs) {
          element.bind('click', function () {
              $(element).css('color','#19B5FE');
          })
      }
  }
});
diary.directive('removeNotes',函数(){
返回{
限制:'E',
范围:{
附注:“=附注”
},
控制器:{
//在此处定义removeNote函数
},
模板:“”,
链接:函数($scope,element,attrs){
元素绑定('单击',函数(){
$(element.css('color','#19B5FE');
})
}
}
});

希望这有帮助

将其放入模板中:

<remove-notes notes="Notes"></remove-notes>

试试这个:

    diary.directive('removeNotes', function () {
  return {
      restrict: 'E',
      scope: {
        notes : "=notes"
      },
      controller: {
        // Define removeNote function here
      },
      template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(notes.notes_uid)">',
      link: function ($scope,element,attrs) {
          element.bind('click', function () {
              $(element).css('color','#19B5FE');
          })
      }
  }
});
diary.directive('removeNotes',函数(){
返回{
限制:'E',
范围:{
附注:“=附注”
},
控制器:{
//在此处定义removeNote函数
},
模板:“”,
链接:函数($scope,element,attrs){
元素绑定('单击',函数(){
$(element.css('color','#19B5FE');
})
}
}
});

希望这有帮助

将其放入模板中:

<remove-notes notes="Notes"></remove-notes>

试试这个:

    diary.directive('removeNotes', function () {
  return {
      restrict: 'E',
      scope: {
        notes : "=notes"
      },
      controller: {
        // Define removeNote function here
      },
      template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(notes.notes_uid)">',
      link: function ($scope,element,attrs) {
          element.bind('click', function () {
              $(element).css('color','#19B5FE');
          })
      }
  }
});
diary.directive('removeNotes',函数(){
返回{
限制:'E',
范围:{
附注:“=附注”
},
控制器:{
//在此处定义removeNote函数
},
模板:“”,
链接:函数($scope,element,attrs){
元素绑定('单击',函数(){
$(element.css('color','#19B5FE');
})
}
}
});

希望这有帮助

将其放入模板中:

<remove-notes notes="Notes"></remove-notes>

试试这个:

    diary.directive('removeNotes', function () {
  return {
      restrict: 'E',
      scope: {
        notes : "=notes"
      },
      controller: {
        // Define removeNote function here
      },
      template: '<i  class="fa fa-close fa-fw" ng-click="removeNote(notes.notes_uid)">',
      link: function ($scope,element,attrs) {
          element.bind('click', function () {
              $(element).css('color','#19B5FE');
          })
      }
  }
});
diary.directive('removeNotes',函数(){
返回{
限制:'E',
范围:{
附注:“=附注”
},
控制器:{
//在此处定义removeNote函数
},
模板:“”,
链接:函数($scope,element,attrs){
元素绑定('单击',函数(){
$(element.css('color','#19B5FE');
})
}
}
});


希望这有帮助

不起作用。。当我检查元素面板时,单击
保持不变
Notes.Notes\u uid
没有被uid替换。你的意思是
Notes.Notes\u uid
没有被转换为uid吗?它没有..Notes.Notes\u uid保持不变,它没有从我想要使用$http发送到后端PHP代码的数组中获取它应该的值..元素检查器显示
ng click=“removeNote(Notes.Notes\u uid)”
它应该显示类似于
ng click=“removeNote(xxx)”
的内容,其中
xxx
是我要传递到后端的uid。似乎Notes还没有被传递到指令的范围内,请检查我的更新。仍然不会提取Notes唯一ID。。它保持不变
removeNote(note.notes\u uid)
不起作用..当我检查元素面板
ng时,单击=“removeNote(notes.notes\u uid)
保持不变
Notes.Notes\u uid
没有被uid替换。你的意思是
Notes.Notes\u uid
没有被转换为uid吗?它没有..Notes.Notes\u uid保持不变,它没有从我想要使用$http发送到后端PHP代码的数组中获取它应该的值..元素检查器显示
ng click=“removeNote(Notes.Notes\u uid)”
它应该显示类似于
ng click=“removeNote(xxx)”
的内容,其中
xxx
是我要传递到后端的uid。似乎Notes还没有被传递到指令的范围内,请检查我的更新。仍然不会提取Notes唯一ID。。它保持不变
removeNote(note.notes\u uid)
不起作用..当我检查元素面板
ng click=“removeNote(notes.notes\u uid)
保持不变
notes.notes\u uid
没有被uid替换。你的意思是
notes.notes\u uid
没有