html कोड
& lt; div ng- click = "sortOrder ($ event, पूर्णनाम ') "वर्ग =" कर्नल- xs-2 sortable asc "& gt; & LT; अवधि & gt; नाम से & lt; / span & gt; & Lt; / div & gt; यहां जेएस कोड है
$ scope.sortOrder = function (ईवेंट, नाम) {var $ elem = $ (event.target); var c = $ elem.hasClass ('desc')? 'एसीसी': 'एड्स'; $ Elem.removeClass ('asc desc')। AddClass (सी); }
टेक्स्ट "itemprop =" text ">
इसके बजाय currentTarget का उपयोग करें: var $ elem = $ (event.currentTarget); वर्तमान लक्ष्य पर ईवेंट श्रोता बनने वाला तत्व है, लक्ष्य तत्व को ट्रिगर करने वाला तत्व है।
इसका अर्थ है कि यदि आप अवधि लक्ष्य अवधि होगी और यदि आप div पर क्लिक करेंगे तो लक्ष्य div हो जाएगा लेकिन दोनों मामलों में currentTarget div हो जाएगा। एक और आसान समाधान के बजाय ng-class का उपयोग करना है। HTML :
& lt; div ng-click = "changeSortOrder ()" class = "col-xs-2 sortable" एनजी-वर्ग = "सॉर्ट ओर्डर" & gt; & LT; अवधि & gt; नाम से & lt; / span & gt; & Lt; / div & gt; जेएस:
$ scope.sortOrder = 'asc'; $ scope.changeSortOrder = फ़ंक्शन () {$ scope.sortOrder = $ scope.sortOrder === 'एस्क'? 'Desc': 'एसीसी'; }; डेमो : आपके तर्क के साथ उदाहरण निर्देश में चला गया:
जेएस:
एप दि डायरेक्टिव ('माइसोर्ट', फंक्शन () {रिटर्न: स्कोप: सच्चा, लिंक: फंक्शन (स्कोप, एलीमेंट) {var डिफ़ॉल्टSortOrder = 'asc'; element.addClass (defaultSortOrder); var परिवर्तनसॉर्टऑर्डर = फ़ंक्शन ) {Var newOrder = element.hasClass ('asc')? 'Desc': 'asc'; element.removeClass ('asc desc')। AddClass (नया ऑर्डर);}; element.on ('click', changeSortOrder); दायरा। $ ('$ नष्ट', फ़ंक्शन () {element.off ('click', changeSortOrder);});}}}); HTML:
& lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; तत्व 1 & lt; / span & gt; & Lt; / div & gt; & Lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; एलिमेंट 2 & lt; / span & gt; & Lt; / div & gt; & Lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; तत्व 3 & lt; / span & gt; & Lt; / div & gt; डेमो :
Popular posts from this blog
I'm trying to pass an input text from the viewer to the controller in the Facebook Birthday app: Link to app: In the Home Controller [FacebookAuthorize ("email", "user_photos")] Public async Tasks & lt; ActionResult & gt; Index (FacebookContext reference) {if (ModelState.IsValid) {var user = waiting for reference. Client.Gate CurrentUserAsync & lt; MyAppUser & gt; (); View return (user); } See Return ("Error"); } [Http post] [facebook authorized ("email", "user_photo")) public async task & lieutenant; Actionsclass & gt; Index (string textile, facebookcontonte context) {if (ModelState.IsValid) {var user = wait context.Client.GetCurrentUserAsync & lt; MyAppUser & gt; (); // See my code, see the use of txt here (user); } See Return ("Error"); } View: @using facebookpostc.models @ Microsoft.AspNet.Mvc.Facebook.models using @ Microsoft.AspNet.Mvc. Facebook @model MyAppUser @ {ViewB...
I have used 2 database tables and core data / NSManagedObjects in SQLite: User is user_id name group (multiple groups) Group group_id title group members (multiple users) By using core data to save a group and adding users ( Add to group) as follows: group * cordata = zero; Cordata = [NSEntityDescription insertNewObjectForEntityForName: @ Managed Object Contains in "Groups": Reference]; Request = [NSFetchRequest fetchRequestWithEntityName: @ "user"]; Request.predicate = [NSPredicate predicateWithFormat: @ "user_id =% @", user_id]; Result = [reference executeFetchRequest: request error: & amp; Error]; CoreData.group_id = group_id Cordettitle = Title [Cordata AdGroupMailersObject: [Last objections result]]; Is it right to say that core data manages a user with multiple users and groups with the code above? Yes, if the relationships are in the form of each other's inverse relationship The inverse relationships are updated automaticall...
I am calling a string with a C + code and calling from the C # code. The C ++ function is responsible for filling the string material. The following code is: C #party: var abc = new string builder (4096); // will have to change this var result = Basic methods. SignCrcFile (ABC); C ++: bool __cdecl SignCrcFile (char * abc) {... char * tempStr = "hello all"; // for example // copy it to ABC string strcpy (ABC, tempStr); Back true; } The problem is that tempStr's size in the C ++ function is dynamic (the above assignment for TempStr is only an example). In such a case, it is not a hard code that the size of ABC string is in the size of 4096 bytes on the C #. The first solution can be a solution to create 2 functions on the C ++ side to get the size of the string. Then allocate that size using StringBuilder in the C # side then use the next function to bring the entire string from C ++ to the C #. But no suggestion this may not be the most optimal way? ...
Comments
Post a Comment