Hello,
I'm a newbie in AngularJS ( and Front-end) and having a lot fun with it. Or
had a lot of fun with it until this.
I'm trying to make a form app where only a single input is shown per page.
Basically each stage of filling out the form is separated into single HTML
pages.
And each HTML page has it's own controller.
Each page gets data from the <input> field and sends it to the Factory.
At the last stage all the data that has been accumulating in the Factory
gets shown.
The reason for separating each page was to add animation when a new page
loads. (I couldn't find out any other way)
Anyways I was not able to show the data from the Factory at the last page.
Only to find out that when I jump to the next page the browser refreshes
therefore the Factory data is constantly "undefined".
In my HTML I have a div with ng-view attached to it. Then in my JS file I
have the following ngRoute.
myApp.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'enterCardNumber.html',
controller: 'IndexController'
})
.when('/validateUser', {
templateUrl: 'enterCardNumber.html',
controller: 'MobileNumberController'
})
.when('/validateSMS', {
templateUrl: 'enterCardNumber.html',
controller: 'ValidateMobile'
})
.when('/sendMoney', {
templateUrl: 'sendMoney.html',
controller: 'SendMoneyController'
})
.when('/sendMoney-confirm', {
templateUrl: 'sendMoney-confirm.html',
controller: 'SendMoneyConfirm'
})
.otherwise({
redirectTo: '/'
})
});
my problem is every time I go to a different view the page refreshes
therefore I'm unable to access the factory service. The data being sent
from Factory gets reset.
At first no matter what I do I was unable to get or set any data to my
Factory. I read through god knows how many stackoverflow Q&As.
Eventually tried to redo my project and then I realized my browser
refreshes when jumping from one view to the next.
Now I remade this project without any styles and the new one seems to work
fine. No refreshes.
Below is the remade ngRoute:
myApp.config(function($routeProvider){
$routeProvider.
when('/', {
templateUrl: 'page1.html',
controller: 'firstController'
})
.when('/page2', {
templateUrl: 'page2.html',
controller: 'secondController'
})
.when('/page3', {
templateUrl: 'page3.html',
controller: 'thirdController'
})
.when('/page4', {
templateUrl: 'page4.html',
controller: 'forthController'
})
.when('/page5', {
templateUrl: 'page5.html',
controller: 'fifthController'
})
});
So I'm wondering if anyone else has had this problem? Is there a way to fix
it? Is it HTML, CSS, or AngularJS?
Could it be "compass" (scss preprocessor)?
Could it be ruby? (config.rb) file?
Could it be scss?
Why would one project refresh when jumping from one view to the next and
the other project doesnt?
Please help.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.