简体   繁体   中英

ui router issue with Materialize CSS

I am using Materialize CSS with Angular ui.router to handle states and render HTML.

But facing issue with Materialize Select as it is not initialized on state change as Materialize components renders on document load.

HTML

<div class="row no-gutter margin-bottom-0">
    <div class="input-field col s4">
        <label>Date</label>
        <select ng-model="day" ng-options="o for o in days" required>
            <option value="DD">DD</option>
        </select>
    </div>
</div>

app.js

$stateProvider
    .state('signup', {
        url: '/signup',
        templateUrl: '/partials/signup.html',
        onEnter: function($window){$window.document.title = "SignUp"; }
    })

I tried using resolve as below:

resolve: {
       function(){
         $('select').material_select();
        }
 },

but no luck.. Any idea how to reinitialize material_select();

有时Angular无法与Materialize一起使用,请尝试合并Angular Materialize: http : //krescruz.github.io/angular-materialize/#select

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM