issue getting data of other page in a single page application using AngularJs -


this app.js,

var myapp = angular.module('myapp', ['ngroute']);  myapp.config(function($routeprovider){     $routeprovider.when('/',{         templateurl: 'views/home.html',         controller: 'homectrl'     }).when('/detail',{         templateurl: 'views/details.html',         controller: 'detailctrl'     }).otherwise({         redirectto: '/home'     });  });  myapp.controller('homectrl',function($scope){     $scope.message ="welcome home page" });  myapp.controller('detailctrl',function($scope){     $scope.message ="name: manish" }); 

this index.html page,

    <html >       <head>         <meta charset="iso-8859-1">         <title>try out</title>         <script type="text/javascript" src="js/angular.js"></script>         <script type="text/javascript" src="js/angular-route.js"></script>         <script type="text/javascript" src="js/app.js"></script>       </head>      <body ng-app="myapp" ng-controller="homectrl" style="text-align: center;">         <span ><a href="/">{{message}}</a></span><br>          <a href="#/">home</a>&nbsp;&nbsp;         <a href="#/detail">details</a>          <br><br>         <div ng-view></div>          <h4>copyright 2017</h4>       </body>    </html> 

this home.html

<h3>home</h3><br>  {{message}} 

same in details.html

<h3>details</h3><br>  {{message}} 

problem when run on server going home page @ first.but when click on details..its not showing message of details.html. , main problem url...clicking on details link..

http://localhost:7675/angularjsinglepage/#!/#%2fdetail 

as u can notice "!/#%2f" comes in between..don't know where,it should come this

http://localhost:7675/angularjsinglepage/#/detail 

any 1 faced same problem? me out, trying learn spa using angularjs?

answered @ https://stackoverflow.com/a/41273403 :)

in addition not have spacontroller in app.js referenced in


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -