1

I have a blade view in laravel 5 along with my angular code as below

<li ng-if="data != null" class="item" style="height: 120px;"  data-ng-repeat="page in data | filter:searchDefaultTerm">
  <div style="margin: 5px;">
     <a href="<% page.guid %>"><span class="fa fa-eye pull-right"></span></a>
     <a href="{{ url('/administrator/page/edit/'.'<% page.id %>')}}" ><i class="fa  fa-pencil pull-right"></i></a>
     <a class="trashButton" href="{{ url('/administrator/page/delete/'.'<% page.id %>') }}" style="cursor: pointer;"><i class="fa fa-trash-o pull-right"><  /i></a>
  </div>
   <img class="pull-left product-img" style="margin: 5px;" height="100" width="100" src="<% page.image %>">
   <a class="product-title "><% page.title %></a><br/>
     <em style="margin: 5px;">Menu Title:</em> <a  class="product-title "><% page.menuTitle %></a><br/>             
     <em style="margin: 5px;">Added Date:</em> <a  class="product-title "><% page.addedDate %></a><br/>
     <em style="margin: 5px;">Updated Date:</em> <a  class="product-title "><% page.updateDate %></a>
</li>

Everything was woking fine in the angular development server but as soon as I moved it to wamp server I am getting the following error

Use of undefined constant page - assumed 'page'

This is my angular code defining new start and end symbol for angular I dont have error with in my console caused due to angular

/*
* Angular App
*/
var app = angular.module('customApp',[],function($interpolateProvider){
    $interpolateProvider.startSymbol('<%');
    $interpolateProvider.endSymbol('%>');
});

I have also tried this

var app = angular.module('customApp', []);

app.config(function($interpolateProvider) {
    $interpolateProvider.startSymbol('<%');
    $interpolateProvider.endSymbol('%>');
});

This is the screenshot of error I have received enter image description here

xenish
  • 1,384
  • 3
  • 14
  • 17

1 Answers1

0

After a fresh installation of laravel-5. Here's the solution to you

Here's the welcome.blade.php

<html>
    <head>
        <title>Laravel</title>

        <link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
        {!! HTML::style('public/css/app.css') !!} 
        {!! HTML::script('public/js/angular.min.js'); !!}
    </head>
    <body>
    @include('angular-stuff'); <!-- app/views/angular-stuff.php -->     
    </body>
</html>

There have a angular-stuff.php file in your app/views folder

Inside your angular-stuff.php have the below code

<div ng-app="">
    <p>Name : <input type="text" ng-model="name"></p>
    <h1>Hello {{name}}</h1>
</div>

Then it should work without any other configuration.

Note : Your file your be angular-stuff.php not angular-stuff.blade.php

Sulthan Allaudeen
  • 11,330
  • 12
  • 48
  • 63