Core Angularjs $http services Remote http via the browsers XMLHttpRequest.
One More thing $http web services is constant path.
constant items declared single page. and use call function.
Constant Page:
App.constant('httppath','app/api/phpfiles/' )
.constant('APP_COLORS', {
'primary': '#5d9cec',
'success': '#27c24c',
'info': '#23b7e5',
'warning': '#ff902b',
'danger': '#f05050',
'inverse': '#131e26',
'green': '#37bc9b',
'pink': '#f532e5',
'purple': '#7266ba',
'dark': '#3a3f51',
'yellow': '#fad732',
'gray-darker': '#232735',
'gray-dark': '#3a3f51',
'gray': '#dde6e9',
'gray-light': '#e4eaec',
'gray-lighter': '#edf1f2'
.constant('APP_COLORS', {
'primary': '#5d9cec',
'success': '#27c24c',
'info': '#23b7e5',
'warning': '#ff902b',
'danger': '#f05050',
'inverse': '#131e26',
'green': '#37bc9b',
'pink': '#f532e5',
'purple': '#7266ba',
'dark': '#3a3f51',
'yellow': '#fad732',
'gray-darker': '#232735',
'gray-dark': '#3a3f51',
'gray': '#dde6e9',
'gray-light': '#e4eaec',
'gray-lighter': '#edf1f2'
Example Code:
modules:
modules: [
{name: 'toaster', files: ['vendor/angularjs-toaster/toaster.js',
'vendor/angularjs-toaster/toaster.css']},
{name: 'toaster', files: ['vendor/angularjs-toaster/toaster.js',
'vendor/angularjs-toaster/toaster.css']},
Controller.js
App.controller('SalesuserController', ['$scope', '$http', '$state', 'toaster', '$timeout', function($scope, $http, $state, toaster, $timeout) {
var notestoaster = {
type: 'success',
};
var data = {'type': notestoaster.type};
$scope.login = function() {
// $scope.authMsg = '';
if ($scope.registerForm.$valid) {
$http.post('app/api/phpfiles/salesuser.php', {username: $scope.username,password: $scope.password,role: $scope.role,phone:$scope.phone, status: $scope.status, type: $scope.type, })
.then(function(response) {
response = response.data;
if (data != "")
{
//alert( response.type);
toaster.pop(response.type, notestoaster.title, response.response);
$timeout(function() {
$state.go('app.dashboard1');
}, 2000);
}
var notestoaster = {
type: 'success',
};
var data = {'type': notestoaster.type};
$scope.login = function() {
// $scope.authMsg = '';
if ($scope.registerForm.$valid) {
$http.post('app/api/phpfiles/salesuser.php', {username: $scope.username,password: $scope.password,role: $scope.role,phone:$scope.phone, status: $scope.status, type: $scope.type, })
.then(function(response) {
response = response.data;
if (data != "")
{
//alert( response.type);
toaster.pop(response.type, notestoaster.title, response.response);
$timeout(function() {
$state.go('app.dashboard1');
}, 2000);
}