0

I'm creating a questionaire for users that allow them to choose and rank personality attributes that best match them. There are three choices in each row and everytime they click on a choice it assigns a ranking out of three.

The first choice would be give "3", second would be "2", etc.

For example here's what one of the rows would look like in the beginning:

[] Thinker []Feeler []Controller

After clicking thinker, then controller then feeler it would look like this:

[3] Thinker [1]Feeler [2]Controller

Pressing a reset button would reset all these choices back to null

Currently I've implemented a way for users to click a choice which adds the number but then there is a problem. If you click the same choice more than once the model keeps changing. How can i lock each choice until a user presses reset or sends the entire quesitonaire? Thanks

controller.js

    $scope.personalityclick=function(column){
var row_1=$scope.row_1;
column = row_1;
if(row_1>0){
     $scope.row_1=row_1-1;  
     return column;
}

};

html

Row 1

 {{row1_column1}} Thinker </span><span span data-ng-
click="row1_column2=personalityclick(2)"> {{row1_column2}} Feeler</span><span span   
   data- ng-click="row1_column3=personalityclick(3)">{{row1_column3}} Controller</span>  
  </p>
  <button data-ng-click="resetrow(1)">Reset </button>   
 </div>

Here is a plunk: http://plnkr.co/edit/pM0aAZAeXKAQeRst5PHm?p=preview

4

1 回答 1

1

你可以这样做:http ://plnkr.co/edit/XdMg3wuRTkW7k54FqRnn?p=preview

于 2013-11-14T02:34:42.680 回答