search

Home  >  Q&A  >  body text

angular.js - What does [] mean in var m = angular.module('hd',[]).

What does [] mean in var m = angular.module('hd',[]).

PHPzPHPz2823 days ago759

reply all(5)I'll reply

  • 天蓬老师

    天蓬老师2017-05-15 17:09:39

    var m = angular.module('hd',[])
    

    means declaring a module called hd. Equivalent to setter, [] represents an array, and the content inside is the other modules that need to be used in the module you are declaring now. For example

    var app = angular.module('app',['ionic'])

    The above means that a module called app is defined, and the ionic module is injected into the app module

    Also

    var m = angular.module('hd') 

    means to get a module called hd. Equivalent to getter

    reply
    0
  • 黄舟

    黄舟2017-05-15 17:09:39

    angular.module('app',[]); // 声明一个module,[]里面添加该model的依赖
    angular.module('app');    // 获取module

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:09:39

    This is a declaration of a moudle.

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-15 17:09:39

    Simply put, []的元素为string is the name of another NG module that depends on it.

    reply
    0
  • 高洛峰

    高洛峰2017-05-15 17:09:39

    [] contains the names of the dependent modules you need to use below ['1', '2'...] like this.

    reply
    0
  • Cancelreply