I have an AngularJS component and I want to add a new function like onclick(). Can this be done within the existing component or do I need to create a new one?
app.component('phoneDetail', {
templateUrl: 'new.html',
controller: ['$http','$routeParams',
function PhoneDetailController($http,$routeParams) {
var valueX = this;
$http.get('http://angular.github.io/angular-phonecat/step-7/app/phones/'+ $routeParams.valueX + '.json').then(function(response){
valueX.phone = response.data;
});
}]
});
$scope.littleSize = false;
$scope.toggleSize = function() {
$scope.littleSize = !$scope.littleSize;
If you have any suggestions or tips on how to achieve this, please share. Thank you.