5
有人可以解釋爲什麼接下來的事情不laravel 5.1工作: 我已經查看文件login1.blade.phpLaravel 5.1,在視圖文件中使用變量名
@extends('ajaxforms.form1')
@section('form')
<input type="text" name="email" /><input type="password" name="password" />
@endsection
@section('script')
<script type="text/javascript">var modalName = '#{{$modalname}}';</script>
@endsection
@section('link')
<li ng-controller="login_controller" id="login_controller">
<a href="#" data-toggle="modal" data-target="#{{$modalname}}">Sign in</a></li>
@endsection
register1.blade.php
@extends('ajaxforms.form1')
@section('form')
<input type="text" name="name" /><input type="text" name="email" />
<input type="password" name="password" /><input type="password2" name="password2" />
@endsection
@section('script')
<script type="text/javascript">var modalName = '#{{$modalname}}';</script>
@endsection
@section('link')
<li ng-controller="register_controller" id="register_controller">
<a href="#" data-toggle="modal" data-target="#{{$modalname}}">Sign in</a></li>
@endsection
..和form1.blade.php
<div id="{{ $modalname }}">
@yield('form')
</div>
@yield('script')
@yield('link')
而且還鏈接在master.blade.php:
@include('ajaxforms.login1',['modalname' => 'modalLogin'])
@include('ajaxforms.register1', ['modalname' => 'modalRegister'])
這會生成代碼:
<div id="modalLogin">
<input type="text" name="email" /><input type="password" name="password" />
</div>
<script type="text/javascript">var modalName = '#modalLogin';</script>
<li ng-controller="login_controller" id="login_controller">
<a href="#" data-toggle="modal" data-target="#modalLogin">Sign in</a></li>
<div id="modalRegister">
<input type="text" name="email" /><input type="password" name="password" />
</div>
<!--Here I want to '#modalRegister' instead of '#modalLogin'; And register_controller
instead of login_controller. Why doesn't work?????????????????????????-->
<script type="text/javascript">var modalName = '#modalLogin';</script>
<li ng-controller="login_controller" id="login_controller">
<a href="#" data-toggle="modal" data-target="#modalLogin">Sign in</a></li>
謝謝