Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

angular scope inside ng click is not working as expected


angular scope inside ng click is not working as expected  using -'angularjs'

I have a ng-repeat which is displaying a list of hotels from a JSON response.  This works fine, but when i come to place a scope data inside an ng-click it isn't working as expected.

I am using:

ng-click="quick_view('{{hotel.hotel_id}}')"


My function is inside the correct controller as is as follows:

$scope.quick_view = function (hotel_id) {
$scope.hotel = hotel_id;


(Hotel ID is 140) so naturally, i would expect 140 to pass to the function quick_view and display '140' when i call {{hotel}}.  Instead, what is being displayed is "{{hotel.hotel_id}}".

Any ideas why this is going wrong?

Many thanks, as usual.
    

asked Oct 11, 2015 by patelnikul321
0 votes
4 views



Related Hot Questions



Government Jobs Opening


...