AngularJS converts element and attr names between HTML markup and JS, replacing dashes with camelCasing, i.e. 'myComponent' -> 'my-component' (and back). which AngularJS service or function does this?
thanks -nikita
Using attrs you are able to access the attributes defined in your html tag like <fm-rating ng-model="$parent.restaurant.price" symbol="$" readonly="true"> So in this case you will have access to the symbol and readonly attributes.
AngularJS directives are extended HTML attributes with the prefix ng- . The ng-app directive initializes an AngularJS application. The ng-init directive initializes application data. The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together.
The $index variable is used to get the Index of an item repeated using ng-repeat directive in AngularJS.
The actual function that does it is called camelCase()
and it is found in jqLite.js which in turn is taken from jQuery.
The use of that function is in the compile stage in directiveNormalize()
update
The reverse is the function snake_case()
in angular.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With