I am new to angular (and javascript). I am trying to build a directive and part of that I need to add an array to the directive's scope. My code for the directive looks something like this:
.directive("startupSections", function(){
return {
restrict: "E",
transclude: true,
scope: {
title: "@",
sections: [1,2,3]
},
link: function(scope, elem, attrs){
console.log (scope);
}
}
});
When executing, I get
TypeError: definition.match is not a function
at angular.js:7992
at forEach (angular.js:417)
at parseIsolateBindings (angular.js:7987)
at parseDirectiveBindings (angular.js:8028)
at addDirective (angular.js:9984)
at collectDirectives (angular.js:9142)
at compileNodes (angular.js:8974)
at compileNodes (angular.js:8990)
at compileNodes (angular.js:8990)
at compile (angular.js:8859)
If I replace the value for "sections" with a string or with a number, the error goes away. Is it possible to have an array as value of a property in the scope? If yes, how?