在我的组件中,我有一张谷歌地图。如果用户更改了地图的中心,我会更改我的URL并在URL中添加新的中心lat-long,以便用户可以将其作为链接发送。像这样的东西: http://myurl.com/map?center=lat!long
我使用RC1的新路由器
答案 0 :(得分:2)
现在正确的语法应该是
<body>
<form>
// some text inputs
// where i'd like the drop down to go
<?php makeList(parameter1, parameter2); ?>
// submit button
</form>
<?php
// connect to database
function makeList(arg1, arg2) {
echo '<select>';
while ($row = mysqli_fetch_array($result)){
echo "<option">;
echo $row[$column];
echo "</option>";
echo '</select>';
}
</body>
答案 1 :(得分:1)
const appRoutes: Routes = [
{ path: 'map/:id', component: mapComponent }]; //id is optional
this.router.navigate(['map', '1', { 'center': 'taiwan' }]);
uri将是这样的:
http://localhost:4200/map/1;center=taiwan
import {Router, ActivatedRoute} from '@angular/router';
export class mapComponent implements OnInit {
constructor(
private route: ActivatedRoute) {
}
ngOnInit() {
//Get route parameter
this.route.params.subscribe(params => {
let custIdValue = params['id'];
let centerValue = params['center'];
//Do somthing...
});
}
}
参考:Angular Doc
答案 2 :(得分:0)
您可以使用:
<?php
Class studdetails {
public $id;
public $name;
public $roll;
}
$details = new studdetails();
$details->id = $sid;
$details->name = $sname;
$details->roll = $sroll;
?>