5
In the Angularjs by default comes the brackets tags ({{
and }}
) for handling, wanted to change to %%
and %%
, how should I proceed ?
Example:
{{name}}
for
%%name%%
5
In the Angularjs by default comes the brackets tags ({{
and }}
) for handling, wanted to change to %%
and %%
, how should I proceed ?
Example:
{{name}}
for
%%name%%
7
To switch, you need to configure in your application this way: no $interpolateProvider, put the startSymbol
and endSymbol
setting out to %%
var App = angular.module('App',[]);
App.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('%%');
$interpolateProvider.endSymbol('%%');
});
Example:
Angular:
var App = angular.module('App',[]);
App.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('%%');
$interpolateProvider.endSymbol('%%');
});
function PeopleListCtrl($scope){
$scope.peoples = [
{'id': 1, 'name': 'Nome 1'},
{'id': 2, 'name': 'Nome 2'}
];
};
Html Complete with Angularjs:
<!DOCTYPE HTML>
<html ng-app="App">
<head>
<meta charset="utf-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.min.js"></script>
</head>
<body>
<div>
<div ng-controller="PeopleListCtrl">
<br />
<p>Quantidade: %%peoples.length%%</p>
<br />
<ol>
<li ng-repeat="p in peoples">%%p.id%% - %%p.name%%</li>
</ol>
</div>
</div>
<script>
var App = angular.module('App',[]);
App.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('%%');
$interpolateProvider.endSymbol('%%');
});
function PeopleListCtrl($scope){
$scope.peoples = [
{'id': 1, 'name': 'Nome 1'},
{'id': 2, 'name': 'Nome 2'}
];
};
</script>
</body>
</html>
Upshot: jsfiddle
References:
Browser other questions tagged angularjs
You are not signed in. Login or sign up in order to post.