I'm trying to pass a string variable from my controller, to a directive that uses isolate scope. I've managed to pass an object and a function, but can't seem to get this working!
controller:
angular.module("app").controller("myCtrl", function($scope)
{
//data that needs to be passed to the directive
$scope.myParams = $scope.params; //object
$scope.myDateOrder = $scope.dateOrder; //string
});
html:
<div ng-controller="myCtrl">
<my-dir params="myParams" dateOrder="myDateOrder">
</my-dir>
</div>
directive:
angular.module("app").directive("myDir", [
function() {
return {
restrict: "E",
scope: {
checkPermissions: "&", //pulled from contact directive -> method/function
params: "=", //passed object though from smwAddCustomerBank -> two way binding
dateOrder: "@" //passed string value from smwAddCustomerBank -> one way binding
},
The dateOrder is not working. If I console.log it in my controller I can see the string, if I then log this in my directive, it is undefined.
Any ideas?