<div ng-controller="ProductsController as products">
<select ng-model="products.sort" ng-change="products.updateList()">
</select>
<ul>
<li ng-repeat="item in products.list">{{ item.name }}</li>
</ul>
</div>
function ProductsController {
var vm = this;
vm.sort = 1;
vm.updateList = updateList;
updateList();
function updateList () {
vm.list = vm.list.sort(function (a, b) {
// логика сортировки тут
});
}
}
"--source-map"
опцию.var path = require('path');
var nwPath = process.execPath;
var nwDir = path.dirname(nwPath);
<body ng-app="app">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="jquery-2.1.4.min.js"></script>
<div ng-controller="MainController"></div>
<script>
var app = angular.module('app', []);
app.service('$myService', function(){
return {hello: 'world'};
});
app.controller('MainController', ['$scope', '$myService', function($scope, $myService){
console.log($myService); // почему $myService undefined?
}]);
</script>
</body>
app.controller('MainController', ['$scope', '$myService', function($scope, $myService){
var a = '1,2,3,4,5';
b = a.replace(/\d/g, function(n){if (n == '1') {return 3} else if (n == '3') {return 2} else if (n == '2') {return '4'} else {return n}});
>> "3,4,2,4,5"
var allValues = {
1: {
price: [2150,2200,2350,1600,1450,1500,1650,900],
itogo: [1450,1500,1650,900,2150,2200,2350,1600]
},
2: {
price: [1800,1850,2000,1250,1150,1200,1350,600],
itogo: [2300,2400,2700,1200,3600,3700,4000,2500]
},
3: {
price: [1617,1667,1817,1100,1017,1067,1217,467],
itogo: [3050,3200,3650,1400,4850,5000,5450,3300]
},
4: {
price: [1525,1575,1725,1025,950,1000,1150,400],
itogo: [3800,4000,4600,1600,6100,6300,6900,4100]
},
5: {
price: [1470,1520,1670,980,910,960,1110,360],
itogo: [4550,4800,5550,1800,7350,7600,8350,4900]
}
}
function setValues(allValues, i) {
var currency = ' руб.'
var valuesGroup = allValues[i]
for (var n in valuesGroup.price) {
$('#price' + n).html(valuesGroup.price[n] + currency)
}
for (var n in valuesGroup.itogo) {
$('#itogo' + n).html(valuesGroup.itogo[n] + currency)
}
}
setValues(allValues, 2)
Есть ли какой нибудь простой способ решить проблему?
если вставлю простой fancybox , то он либо работает криво , либо вообще не работает :(