I have an application with my views in CI folder.
domain.com/apps/view/user/xxx.php
I put Angular on
domain.com/apps/assets/js/app.js
domain.com/apps/assets/js/controllers.js
Currently I am using a static URL to load my view in this application. I use CI Controller for database processing and Angular Controller and Route to display and process the info in the interface.
I face issues when a backup domain is added.
app.js
angular.module('starter', ['ionic', 'starter.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider,$location) {
$stateProvider
.state('app', {
url: "/app",
abstract: true,
templateUrl: "http://m.domain.com/_aps4497/views/user/menu.php",
controller: 'AppCtrl'
})
.state('app.main', {
url: "/main",
views: {
'menuContent': {
templateUrl: "http://m.domain.com/_aps4497/views/user/main.php"
}
}
})
.state('app.message', {
url: "/message",
views: {
'menuContent': {
templateUrl: "http://m.domain.com/_aps4497/views/user/message.php"
}
}
})
$urlRouterProvider.otherwise('/app/main');
});
I tried :
.state('app.message', {
url: "/message",
views: {
'menuContent': {
templateUrl: "http://"+$location.host()+"/_aps4497/views/user/message.php"
}
}
})
error : it is retrieved the same .
.config(function($stateProvider, $urlRouterProvider,$location) {
$stateProvider
.state('app', {
url: "/app",
abstract: true,
templateUrl: "http://"+$location.host()+"/_aps4497/views/user/menu.php",
controller: 'AppCtrl'
})
https://docs.angularjs.org/error/$injector/modulerr?p0=starter&p1=$location%20is%20not%20defined <br>
controller.js
angular.module('starter.controllers', ['pascalprecht.translate'])
.factory('UserService', function($http) {
var data;
return{
getData: function($http) {
return $http.get("http://m.domain.com/user/getUserInfo").
success(function(response) {
/// console.log(JSON.stringify(response));
userData=response.data;
return userData;
}).error(function(data, status, headers, config) {
// log error
});
}
}
})
How do we set the route and location to be dynamic (multiple domain)?
Whats the best practice for the folder system on Angular + CI? if i want to put all my views in the partial folder, where should I put the partial folder to be possibly accessed by Angular controller and app.s?
Please help! Thanks.