<div ng-click='scrollTo("info")'>go to info</div>// some controller
['$scope', $anchorScroll, function($scope, $anchorScroll) {
$scope.scrollTo = function(id) {
$location.hash(id);
$anchorScroll();
}
}];$rootScope.$on('$routeChangeSuccess', function(newRoute, oldRoute) {
if($location.hash()) $anchorScroll();
}); var params = $location.search();$location.search({ id: 1});(function() {
'use strict';
angular
.module('LenaPillars')
.factory('ProfileResource', ProfileResource);
ProfileResource.$injector = ['$rootScope', '$resource'];
function ProfileResource($rootScope, $resource) {
var photosResource = $resource(
$rootScope.storeUrl,
{
checkActiveProfile: {
method: 'GET',
isArray: false,
url: $rootScope.storeUrl+'/checkProfile'
}
}
);
function checkActiveProfile() {
return new photosResource()
.$checkActiveProfile({token: $rootScope.token, setting_profiles: 'setting_profiles'})
// then принимает 2 параметра, для resolve и reject
.then(getAvengersComplete, getAvengersFailed);
function getAvengersComplete(response) {
return response.data.results;
}
function getAvengersFailed(error) {
logger.error('XHR Failed for getAvengers.' + error.data);
}
}
return {
checkActiveProfile: checkActiveProfile,
}
}
})();function getProfileCheck() {
return ProfileResource
.checkActiveProfile()
.then(function(data) {
console.log('gde ti moi data: '+data);
vm.avengers = data;
return vm.avengers;
});
} .when('/search?param1¶m2&.....¶mN',
{
templateUrl: html,
reloadOnSearch: false
controller: 'SearchCtrl'
})$location.serach(
{
param1: 1,
param2: 2
}
); var words = [ {key: 'a', value: 1}, {key: 'b', value: 2}, {key: 'c', value: 3} ];ng-options="word as word.key for word in words track by word.value" return {
require: '^ngModel',
template: '<input ng-model='mod'>',
scope: {
type: "=",
mod: "=",
},
}RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]<input type="number" ng-model="model.amount_users" ng-change="onUserAmountChange()">
<input type="text" ng-model="model.price">$scope.onUserAmountChange = function() {
$scope.model.price = FULL_PRICE/$scope.model.amount_users;
}<input type="number" ng-model="model.amount_users" ng-change="onUserAmountChange()">
<span> {{model.fullPrice/model.amount_users}} </span>