I've found answers about using ngModel within a custom directive, and I understand the concept, but I'm not sure if I am understanding how to implement it when using $resource.
I'm successfully injecting the "file" scope into my directive, and I'm making the api call, but the value that's getting retued to my server is null. I'm sure my Angular directive implementation is where my fault lies.
directive.js
angular.module('pro').directive('buyLinkBox', function() {
retu {
restrict: "AE",
replace: true,
template: '<md-input-container md-no-float md-block><label style="font-size:2.2vh">Buy Link for {{file.filename}}</label><input type="text" ng-blur="sendLink()" ng-model="file.buyLink" name="buyLink" id="buyLink"/></md-input-container>',
scope: {
file: '=',
},
controller: function($scope, $route ,BuyLinkService){
$scope.sending = BuyLinkService.get({
FileId: $scope.file._id
});
$scope.sendLink = function() {
$scope.sending.$sendLink(function() {
$route.reload();
}, function(errorResponse) {
alert('nope');
});
};
}
}
});
html
<buy-link-box file="file"></buy-link-box>
