You need to sign in to do that
Don't have an account?

Angular js not working in visualforce page and I am trying to do this filter, called "myFormat", will uppercase every other character.
<apex:page >
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"/>
<div ng-app="myapp" ng-controller="mycntrl">
<ul>
<li ng-repeat="x in names">
{{ x | myFormat}}
</li>
</ul>
</div>
<script>
var myapp = angular.module('myapp', []);
myapp.filter('myFormat',function(){
return function(x){
var i, c, txt = "";
x=x.split("")
for(i = 0;i <=x.length; i++){
c= x[i];
if(i % 2 == 0){
c= c.toUpperCase();
}
txt += c;
}
return txt;
};
});
myapp.controller('mycntrl', function($scope) {
$scope.names= [
'Jani',
'Carl',
'Margareth',
'Hege',
'Joe',
'Gustav',
'Birgit',
'Mary',
'Kai'
];
});
</script>
</apex:page>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"/>
<div ng-app="myapp" ng-controller="mycntrl">
<ul>
<li ng-repeat="x in names">
{{ x | myFormat}}
</li>
</ul>
</div>
<script>
var myapp = angular.module('myapp', []);
myapp.filter('myFormat',function(){
return function(x){
var i, c, txt = "";
x=x.split("")
for(i = 0;i <=x.length; i++){
c= x[i];
if(i % 2 == 0){
c= c.toUpperCase();
}
txt += c;
}
return txt;
};
});
myapp.controller('mycntrl', function($scope) {
$scope.names= [
'Jani',
'Carl',
'Margareth',
'Hege',
'Joe',
'Gustav',
'Birgit',
'Mary',
'Kai'
];
});
</script>
</apex:page>
Please use the below working code :
Please let me know if it is working fine for you tooo......
All Answers
still not working ,its shows the undefined as a output instead of name.
Could you please tell me what is your requirement...........
So that I can tell you what exactly needs to be done.....
Please use the below working code :
Please let me know if it is working fine for you tooo......
Thanks