Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizGeneral Tech Technology & Software 2 years ago
Posted on 16 Aug 2022, this text provides information on Technology & Software related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
General rule is that you don't need {{...}}
if it has ng-
. So the syntax would be: incrementLikes(technology)
. As long as technology
is scoped, it will update likes correctly. Here is a demo:
ng-app="myApp" ng-controller="myCtrl">
ng-repeat="technology in techologies">
type="button" value="Like" ng-click="incrementLikes(technology)" /> {{technology}}
type="button" value="Dislike" ng-click="decrementLikes(technology)" />
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.techologies = [{
name: "C#",
likes: 0,
dislikes: 0
},
{
name: "ASP.NET",
likes: 0,
dislikes: 0
},
{
name: "SQL",
likes: 0,
dislikes: 0
},
{
name: "AngularJS",
likes: 0,
dislikes: 0
},
];
$scope.incrementLikes = function(technology) {
technology.likes++;
}
$scope.decrementLikes = function(technology) {
technology. dislikes++;
}
});
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 10 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 9 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.
manpreet
Best Answer
2 years ago
Controller has following function:
Now what should I use to call this function while calling it like in the following case:
Should I use {{incrementLikes(technology)}} or incrementLikes(technology), we use
{{variable_name}}
if a "variable_name" is added to $scope, should we do the same for function calls or different, and why?technology is an object of technologies: