angularjs - What are the syntax requirements on Meteor Angular UI.Router linking? -


i following angular-meteor tutorial at: http://www.angular-meteor.com/tutorials/socially/angular1/routing-and-multiple-views

i understand of routing, not see parts tie together. here's thought process.

i routes, notice :partyid.

.state('parties', {         url: '/parties',         template: '<parties-list></parties-list>'       })           .state('partydetails', {             url: '/parties/:partyid',             template: '<party-details></party-details>'           }); 

and in < parties-list >, can see "this.partyid = $stateparams.partyid" being defined.

#1. how :partyid , $stateparams.partyid related?

#2. directive called "partydetails" whereas template < party-details >... implied name given angular?

angular.module('socially').directive('partydetails', function () {     return {       restrict: 'e',       templateurl: 'party-details.html',       controlleras: 'partydetails',       controller: function ($scope, $stateparams) {         this.partyid = $stateparams.partyid;       }     }   }); 

next... inside party-list.html page (not party-details.html), there ui-sref link:

  <li ui-sref="partydetails({ partyid: party._id })" ng-repeat="party in partieslist.parties">     {{party.name}}     <p>{{party.description}}</p>     <button ng-click="partieslist.removeparty(party)">x</button>   </li> 

but in < party-list > directive there no mention of variable or function called "partydetails".

#3.what ui-sref referencing? how compare "< href="/parties/{{party._id}}" >" used further in tutorial.

#4. finally, there should know meteor or angular ui.router in regards things implied/abstracted away?


thank time! :)

  1. it's same. if declare parameters in query string :partyid, received object stateparams keys these parameters , values proportional string in segment of url.
  2. it's coding conversation of angular js. can check out more example. https://docs.angularjs.org/guide/directive
  3. not problem if use correct anywhere. happened if want change link or url structure? example: href="/home" appear more 20 html pages. , want change "/homepage". why???. router, need change url state in router.js file. ok?
  4. angular-meteor 1 of ways build apps angular. related angular, can find separate. example can read angular ui router or package of angularui in link https://angular-ui.github.io

Comments