Yii 1.1: yii-angularjs-helper

Yii AngularJS Helper Widget
7 followers

This extension allows to easily load and embed your AngularJS application from a Yii view.

Requirements

  • Yii 1.1 (tested on version 1.1.14)

Main Features

  • publish and load AngularJS base script and required modules
  • publish and load your AngularJS application assets
  • concatenate AngularJS application scripts into a single file
  • replace placeholders values on assets publication
  • flexible configuration

Getting started

  • download the extension
  • copy the angularHelper folder from the examples folder to your modules folder and enable it in your configuration file
  • open index.php?r=angularHelper/default/index in your browser
  • have a look at the source code of the extension (YiiAngularjsHelper.php) and of the example module

Usage

<?php $this->beginWidget('ext.yii-angularjs-helper.YiiAngularjsHelper', array(
        'appName' => 'testApp',
        'hasAppModule' => true,
        'appFolder' => dirname(__FILE__).'/../../angularjs/app1',
        'commonAppScripts' => array(
            dirname(__FILE__).'/../../angularjs/common/config_httpProvider.js',
            dirname(__FILE__).'/../../angularjs/common/config_locationProvider.js',
        ),
        'appScripts' => array('test.js'),
        'appStyles' => array('style.css'),
        'requiredModulesScriptNames' => array('route', 'animate'),
        'customPlaceholders' => array('[:DATETIME]' => date('Y-m-d H:i:s')),
        'scriptsPosition' => CClientScript::POS_HEAD,
        'concatenateAppScripts' => true,
        'debug' => false,
    )
); ?>
 
 
<nav>
    <ul class="inline-block-list">
        <li><a href="#!/">Home</a></li>
        <li><a href="#!/page1">Page 1</a></li>
        <li><a href="#!/page2">Page 2</a></li>
    </ul>
</nav>
 
<div data-ng-view class="view-animate"></div>
 
 
<?php $this->endWidget('ext.yii-angularjs-helper.YiiAngularjsHelper'); ?>

Resources

Total 2 comments

#18153 report it
Palraj Arockiaraj at 2014/09/17 07:41am
ng grid

Hi, How can i use ng grid with this extension?.

#17104 report it
Fire at 2014/05/03 01:25pm
Very cool...

Hi there, nice to see more Angular stuff finding its way into Yii...

I am wondering, how do you do authentication with Angular and Yii? I am using Angular.js for the frontend

Leave a comment

Please to leave your comment.

Create extension