0

in an Angularjs controller i have the following function:

 function colorDropDownEditor(container, options) {
    $('<input data-text-field="Myobject" data-value-field="Referente" data-bind="value:' +    options.field + '"/>')
    .appendTo(container)
 ...
 ...

Now my question is: how angularjs can execute the jquery method? How can interpret the "$" symbol?

Thanks

3
  • 3
    Read this : stackoverflow.com/a/15012542/1125027. It describes how to use jQuery with AngularJS. Commented Jun 14, 2014 at 13:30
  • You can use $ as a variable to hold anything - it doesn't have to be jQuery. That said, this does look like jQuery so maybe the author has assumed it Commented Jun 14, 2014 at 13:30
  • 1
    I'd recommend away from twisting jquery into angularjs like that. Here is a directive in angularjs for a color-picker. ngmodules.org/modules/ng-color-picker You'll get more power and leverage angularjs better binding with it and trying to push angular out to jquery. A directive will give you this power. Commented Jun 14, 2014 at 13:34

1 Answer 1

2

Angular includes jqLite, which implements a subset of all jQuery functionality.

From the Angular FAQ:

Yes, Angular can use jQuery if it's present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.

Sign up to request clarification or add additional context in comments.

Comments

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.