Reputation: 3637
This may be common out here, but I can't find the solution. I am trying to pass params to an angular directive, as objects, but I only get 'undefined'.
Directive:
app.directive('someInfo', ['someService', function (someService) {
return {
restrict: 'E',
scope: {
'firstId': "=",
'secondId': "="
},
templateUrl: 'Views/layout/some.info.html',
controller: function ($scope, $attrs) {
someService.getSome($scope.firstId).then(function (response) {
$scope.some= response.data.some;
}, function (error) { });
}
}
}]);
Usage:
<some-info firstId='myFirst' secondId='mySecond'></some-info>
Also, how do I enforce passing the two params.
Upvotes: 0
Views: 177
Reputation: 33544
camelCase is converted to dashes in parameters:
<some-info first-id="myFirst" second-id="mySecond"></some-info>
Upvotes: 4