when extending view in laravel blade, have multiple places of inserting, can done this:
<html> <head> <title>this app/view/layout/default.blade.php</title> {{ html::script('js/jquery-2.1.3.min.js') }} {{ html::script('js/angular.js') }} @yield('extra_libraries') </head> <body> <div class="left-menu-bar"> @yield('left-menu-bar') </div> <div class="main-content"> @yield('main-content') </div> </body> </html>
then, when using layout,
@extend ("layout.default") @section('extra_libraries') {{ html::script('js/underscore.js') }} @stop @section('left-menu-bar') <a href="http://www.google.com/">testing button</a> @stop @section('main-content') testing @stop
what want similar function when not extending include blade current blade. i.e. this:
<html> <head> <title>this app/view/layout/default.blade.php</title> {{ html::script('js/jquery-2.1.3.min.js') }} {{ html::script('js/angular.js') }} </head> <body ng-app="mytestingapp"> <div ng-controller="testing"> @include('components.componenta.htmlcomponent') @include('components.componentb.htmlcomponent') </div> <script> var app = angular.module('mytestingapp', []).controller("testing", testingcontroller); function testingcontroller($scope) { @include('components.componenta.angularcode') @include('components.componentb.angularcode') } </script> </body> </html>
where componenta should blade file containing both anguarcode , htmlcomponent. know can separate them 2 files, want see if there way put them in same file closely related. there default function in laravel blade achieve this?
p.s. example shows why want put them together, if know angularjs.
to include blade current blade
well, include blade file inside existing one, @include tag comes save day. if still doesn't satisfies requirements, can write own methods extending blade.
however, whole thing seems little complicated me. why don't separate javascript different controllers , use ng-view call corresponding html, shown in example @ bottom of documentation.
Comments
Post a Comment