I am trying to send data from controller to directive , but i am getting undefined why ?
here is my code https://plnkr.co/edit/0gtFynDdvyY0sWqKGI2l?p=preview
I do the following steps
<div img-upload="" previewData="data" method="POST"
url="webfreaks.in/dummyService">
</div>
previewData="data"
send data in directive in controller I defined like this
$scope.data =['sds']
but when i am trying to get its value in the directive . I am getting undefined
undefined
why ?
link : function(scope,elem,attrs){
var formData = new FormData();
console.log(scope.previewData)
scope
scope : {
url : "@",
method : "@",
previewData:'=',
},
模板中的PreviewData必须像这样的“预览数据”(使用kebab-case进行模板中的绑定):
<div img-upload="" preview-data="data" method="POST" url="webfreaks.in/dummyService"></div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.