Reputation: 27
How can i assign a jquery element to angularjs? i tried:
var scope = $scope;
scope.project = $( "#project" ).val();
But it didn't worked for me. Someone has a solution for this?
Thanks in advance
Upvotes: 0
Views: 2692
Reputation: 953
I guess that is the best way:
put inside your jquery event..
$(document).ready(function () {
var controllerElement = document.querySelector('[ng-controller="yourController"]');
var scope = angular.element(controllerElement).scope();
scope.$apply(function () {
scope.yourProperty = 'your value';
});
});
Upvotes: 0