angularjs - Inject config/constant from html -
i have problem, easier me inject configuration angular app html. i'm thinking like:
in html:
<body ng-app="myapp" my-config="abc"> </body>
so later convert it constant, can easier reuse value across rest of app. like:
angular .module('myapp', []) .constant('my_config', /** value become set in html */);
would possible? help!
i've solved differently. in end of <body>
, after js files loaded i'm setting value:
<body ng-app="myapp"> <!-- [...] --> <script> angular .module('myapp') .constant('my_config', 'testing.config'); </script> </body>
Comments
Post a Comment