0

We have a piece of code that suppose to manipulate an existing element.

It looks like this:

[this.box] = angular.element('#pop-box-' + this.$scope.$id);
this.box.css({...});

Debugging this, the box is found properly and it is the right element. However, I am getting an error that css is not a function. Based on the docs https://docs.angularjs.org/api/ng/function/angular.element, the element should have that available.

In our case, jQuery is also in the project.

What am I missing?

7
  • can you put your relevant code in stackblitz fork and post link:stackblitz.com/edit/angularjs Commented Feb 3, 2019 at 7:28
  • what this braces for? [this.box] Commented Feb 3, 2019 at 8:05
  • @LuninRoman It is a destructuring assignment, it extracts the first element from an array, see: deadcoderising.com/… Commented Feb 3, 2019 at 8:18
  • 1
    Did you try the same code but without destructuring? Commented Feb 3, 2019 at 8:21
  • 1
    stackoverflow.com/questions/24365428/… Commented Feb 3, 2019 at 8:22

1 Answer 1

0

Wrap your element in $()

$(this.box).css({...});
Sign up to request clarification or add additional context in comments.

1 Comment

Post your Code please

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.