angular js and jquery integration

Hi,

I have the following part of a code, its work, but when i click a td, i have an angular expression {{car1}} that don't change, what i can do?
 //document ready
          angular.element(document).ready(function () {

              $("td").each(function(){$(this).attr('pr1',parseFloat($(this).html().replace("$","")))});

             $("td").click(function(){
                 $scope.car1 = $scope.car1 + parseFloat($(this).attr('pr1'));
                 alert($scope.car1);
             });


          })
          //fin del document ready

Open in new window

LVL 1
joyacv2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Apologies - just re-read the question - do you have a page online we can look at?
0
joyacv2Author Commented:
sorry, no
0
joyacv2Author Commented:
i can change using an id and jquery.html() function, but i want to use angular because is more simple and have a currency filter for expressions
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Julian HansenCommented:
Ok but with only that snippet of code - sort of like bringing the spare tyre of car into the shop and asking why it won't start.
0
joyacv2Author Commented:
ok,

how i update an <span>{{tdclicked}}</span> or any other tag, when i click a 'td' using angular js expressions?
 i want that when i click a td, then the span tag takes its value + the previous value
0
Julian HansenCommented:
This seems to work
<!doctype html>
<html ng-app="tdtest">
<head>
<title>Test</title>
<style type="text/css"></style>
</head>
<body ng-app="">
<div ng-controller="tdTestController as tdc">
	<table>
		<tr>
			<td>Name</td><td ng-click="tdc.clickTD($event)">John Smith</td>
		</tr>
		<tr>
			<td>Name</td><td ng-click="tdc.clickTD($event)">Jane Doe</td>
		</tr>
	</table>
	<span>{{tdc.tdclicked}}</span>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<!-- <img src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.js"></script>
<script type="text/javascript">
angular.module('tdtest', [])
	.controller('tdTestController', function() {
		var tdc = this;
		tdc.tdclicked = '';
		tdc.clickTD = function (e){	
			tdc.tdclicked = $(e.target).html();
		}
	});
</script>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.