symfony webpack encore angularJS
symfony webpack encore angularJS
我从 Symfony3.4 迁移到 SF4/Flex。
我在 SF3.4 中使用 assetic/bundle 但现在我尝试将其替换为 symfony/webpack-encore.
当我开始使用时一切正常,但在我的页面中我无法显示我的网络服务中返回的值。
在我的 topTripsController 中,使用网络服务获取对象列表,然后我尝试呈现它们
<div ng-controller="topTripsController as homeNotLogged">
<div data-ng-repeat="trip in homeNotLogged.trips track by $index" >
<a ng-if="trip.cover.url " id="trip-||$index||">
<h2 class="trip-title" style="font-size: 14px; font-weight: bold" ng-bind="trip.name | capitalize">
</h2>
<div class="trip-date">
<span class="trip-title-first_name" ng-bind="trip.profile.name"> </span>
<span > · </span>
<span class="trip-title-from-date" ng-bind="trip.fromDate | date:'MMM, y'"> </span>
</div>
</a>
</div>
</div>
{% block javascripts %}
{{ parent() }}
<script src="{{ absolute_url(asset('build/js/pages/index.js')) }}" ></script>
{% endblock %}
当我写
{{trip }}
我得到了这个结果
{"Id":15,"Profile":{"Id":2,"Name":"Alex Fergusson","URLname":"alex","Picture":{"Url":"d2d1117d023f81739aa7681fb60b98e92208d8c7.jpeg","Alt":""}},"Slug":"the-ultimate-one-week-istanbul-itinerary-and-guide","Themes":[{"Id":938,"Name":"Art & Design","Slug":"art-design"},{"Id":943,"Name":"History","Slug":"history"},{"Id":944,"Name":"Local Culture","Slug":"local-culture"}],"Name":"The Ultimate 5 Days Istanbul Itinerary and Guide","Cover":{"Url":"cb33d105cb7eaa59a912fac1df5e9c86d1562588.jpeg"},"Description":"vaoila dsvdvsdvsdv","FromDate":1480118400000,"NbrViews":1405,"NumCheckin":38,"NumPhoto":209,"NumLike":203,"NumComment":24,"Tigr":61.808134736842,"Published":true,"MapLines":true,"ToDate":1511005270,"DatesKnown":true,"Duration":358,"CreatedAt":"2017-07-17T09:05:47+02:00","UpdatedAt":"2018-04-02T15:37:34+02:00","Disable":false,"GooglestaticUrl":"the-ultimate-one-week-istanbul-itinerary-and-guide-travel-itinerary-1509033384.png","MonthViews":0}
如果我做
{{trip.id}} {{trip.name}}
或 trip.anything 我没有结果,但我知道这些属性不为空。
只有当我在 SF4 项目中将 wepback 与 angularJS@1.5.8 一起使用时才会出现此问题。
有什么想法吗?
正如Json建议的那样,你应该这样做,
{{trip.Id}} {{trip.Profile.Id}} {{trip.profile.Name}}
我从 Symfony3.4 迁移到 SF4/Flex。 我在 SF3.4 中使用 assetic/bundle 但现在我尝试将其替换为 symfony/webpack-encore.
当我开始使用时一切正常,但在我的页面中我无法显示我的网络服务中返回的值。
在我的 topTripsController 中,使用网络服务获取对象列表,然后我尝试呈现它们
<div ng-controller="topTripsController as homeNotLogged">
<div data-ng-repeat="trip in homeNotLogged.trips track by $index" >
<a ng-if="trip.cover.url " id="trip-||$index||">
<h2 class="trip-title" style="font-size: 14px; font-weight: bold" ng-bind="trip.name | capitalize">
</h2>
<div class="trip-date">
<span class="trip-title-first_name" ng-bind="trip.profile.name"> </span>
<span > · </span>
<span class="trip-title-from-date" ng-bind="trip.fromDate | date:'MMM, y'"> </span>
</div>
</a>
</div>
</div>
{% block javascripts %}
{{ parent() }}
<script src="{{ absolute_url(asset('build/js/pages/index.js')) }}" ></script>
{% endblock %}
当我写
{{trip }}我得到了这个结果
{"Id":15,"Profile":{"Id":2,"Name":"Alex Fergusson","URLname":"alex","Picture":{"Url":"d2d1117d023f81739aa7681fb60b98e92208d8c7.jpeg","Alt":""}},"Slug":"the-ultimate-one-week-istanbul-itinerary-and-guide","Themes":[{"Id":938,"Name":"Art & Design","Slug":"art-design"},{"Id":943,"Name":"History","Slug":"history"},{"Id":944,"Name":"Local Culture","Slug":"local-culture"}],"Name":"The Ultimate 5 Days Istanbul Itinerary and Guide","Cover":{"Url":"cb33d105cb7eaa59a912fac1df5e9c86d1562588.jpeg"},"Description":"vaoila dsvdvsdvsdv","FromDate":1480118400000,"NbrViews":1405,"NumCheckin":38,"NumPhoto":209,"NumLike":203,"NumComment":24,"Tigr":61.808134736842,"Published":true,"MapLines":true,"ToDate":1511005270,"DatesKnown":true,"Duration":358,"CreatedAt":"2017-07-17T09:05:47+02:00","UpdatedAt":"2018-04-02T15:37:34+02:00","Disable":false,"GooglestaticUrl":"the-ultimate-one-week-istanbul-itinerary-and-guide-travel-itinerary-1509033384.png","MonthViews":0}
如果我做
{{trip.id}} {{trip.name}}或 trip.anything 我没有结果,但我知道这些属性不为空。
只有当我在 SF4 项目中将 wepback 与 angularJS@1.5.8 一起使用时才会出现此问题。
有什么想法吗?
正如Json建议的那样,你应该这样做,
{{trip.Id}} {{trip.Profile.Id}} {{trip.profile.Name}}