5

Been reading the AngularJS documentation and found some param type

!Array.<string>=

What does this mean? any answer would clear things up.

4
  • 5
    can you point to the link for context? Commented Mar 16, 2016 at 3:35
  • You can see it in the code - That is an type indicator for the parameter saying it is expecting an array of string values as the said parameter Commented Mar 16, 2016 at 3:41
  • @Gary Angular Module Commented Mar 16, 2016 at 3:42
  • @ArunPJohny Well why the !Array.<string>? is '!' an inverse? Commented Mar 16, 2016 at 3:45

1 Answer 1

2

The operators are from Google Closure's Type Expressions.

  • ! identifies the type as "Non-nullable."
  • <...> identifies the type(s) of an object/collection's contents.
  • = identifies the parameter as "Optional."

So, in the case of angular.module():

  • No argument has to be given for requires.
  • When it is given, it cannot be null and must be an Array containing only string values.
angular.module('Foo');               // valid arguments
angular.module('Foo', null);         // not valid
angular.module('Foo', ['Bar']);      // valid
angular.module('Foo', [false]);      // not valid
angular.module('Foo', function(){}); // valid
Sign up to request clarification or add additional context in comments.

2 Comments

but what about the Array.<string> @JonathanLonowski? is the <string> the type??
The <...> represents the type of the contents/elements/etc., so Array<string> is an "array of strings."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.